踩坑记录:Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required
踩坑记录:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
·
处理方式:改spring-boot-starter-parent版本即可,不必配置sqlSessionFactory等相关。
项目原本没有报错,只不过因为同时引入mybatis-plus-boot-starter和mybatis-spring-boot-starter,造成了依赖包冲突,造成mybatis中Mapper的insert等不能使用,没有log输入等问题
移除mybatis-spring-boot-starter后,项目启动失败,提示Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 等错误信息。
原本以为配置了sqlSessionFactory和sqlSessionTemplate等,就能解决问题,但最终也不行,参考了不少问题解答,仍然无法解决。
最后采用写demo的方式来对比,结果发现spring-boot-starter-parent是版本问题造成的。
修改前:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
<relativePath/>
</parent>
修改后:
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.7.RELEASE</version> <relativePath/> </parent>
更多推荐
已为社区贡献1条内容
所有评论(0)