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

本文记录了在SpringBoot项目中整合MyBatis时遇到的BeanCreationException错误,详细解析了错误原因及解决方案,指出问题在于日期类型转换,通过添加自定义类型转换类成功解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在整合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,启动报错。

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

找问题要找对主要的

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值