Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [spring-dao.xml]

x33g5p2x  于2022-04-26 转载在 Spring  
字(0.6k)|赞(0)|评价(0)|浏览(375)

今天在做Spring和Mybatis整合到时候遇到的一个问题。。困扰了我很久。。。emmmmm

问题错误描述:

Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [spring-dao.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.ibatis.session.Configuration.setDefaultEnumTypeHandler(Ljava/lang/Class;)V

翻阅了别人写的解决方案

1.在mybatis配置文件和spring配置文件中都注册了同一个mapper,此时会出现报错,只要删掉mybatis中的配置mapper的部分就可以正常运行了。

2.spring配置标签中,把ref赋值错误的写成了value赋值,也会出现相同的错误,把value改回ref即可解决问题。

可是以上两步我都没有错误的!

我的解决方案

所以。。。emmm我的解决是。。。emmm
jar包版本的问题。。。。。。我原本用的mybatis-spring-2.0.7.jar就一直报这个错误,后面我换成了

删除2.0.7版本jar包

导入1.3.0版本的jar包

emmm就可以…运行了

创作打卡挑战赛

赢取流量/现金/CSDN周边激励大奖

相关文章

微信公众号

最新文章

更多