1、在idea中打开Project Structure

在spring + springmvc + mybatis中出现Error creating bean with name 'sqlSessionFactory' defined in file

2、检查Artifacts中的xxxx:war_exploded下是否有波浪线,如有就说明你的output Layout有问题

在spring + springmvc + mybatis中出现Error creating bean with name 'sqlSessionFactory' defined in file

3、把原来的xxxx:war_exploded删除

在spring + springmvc + mybatis中出现Error creating bean with name 'sqlSessionFactory' defined in file

4、删除后点击+号,选中第二个Web Application:Exploded和From Mouduls

在spring + springmvc + mybatis中出现Error creating bean with name 'sqlSessionFactory' defined in file

5、选中项目

在spring + springmvc + mybatis中出现Error creating bean with name 'sqlSessionFactory' defined in file

6、发现波浪线消失了,重启Tomcat,问题可以解决。

在spring + springmvc + mybatis中出现Error creating bean with name 'sqlSessionFactory' defined in file

总结:一开始出现这个问题,我也很无奈,但看着报错的原因,一步步地去排查问题,最终解决问题了,心里还是很开心的。

相关文章: