关于项目中遇到的错误org.springframework.beans.factory.BeanCreationException

在整合springboot过程中,遇到错误真是无头绪,开始主要是这两个:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'makeSqlSessionFactoryBean' defined in class path resource [com/MyBatisConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'makeSqlSessionFactoryBean' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Eclipse Workspace\pay-source\pay-source\pay-business-soa\target\classes\mybatis\applyWage\ApplyWageMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalStateException: No typehandler found for property createTime

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'a2bServiceImpl': Unsatisfied dependency expressed through field 'mapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'a2bMapper' defined in file [D:\Eclipse Workspace\pay-source\pay-source\pay-business-soa\target\classes\com\huaying\dao\a2b\A2bMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'makeSqlSessionFactoryBean' defined in class path resource [com/MyBatisConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'makeSqlSessionFactoryBean' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Eclipse Workspace\pay-source\pay-source\pay-business-soa\target\classes\mybatis\applyWage\ApplyWageMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalStateException: No typehandler found for property createTime

刚开始找问题,以为是前面的问题,什么注解错误,注解不起作用什么的,在网上搜了一大堆,发现没有什么可以解决问题的,后来,让同事看看,可能是日期类型转换的问题,这个问题在最后一段,开始没有当回事,最后才发现,原来这个问题才是最终造成BeanCreationException和BeanCreationException的原因,真是吐血三升,这个错误Cause: java.lang.IllegalStateException: No typehandler found for property createTime很直白,只是自以为是了,找了个类型转换的转换类加到mybatisConfig的配置类中

这里实体类中日期用的是Calendar,启动报错。

加上转换类,转换一下就没有问题了。。。

找问题要找对主要的


版权声明:本文为BinshaoNo_1原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。