MyBatis-plus报错Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required的解决方法
针对报错如下:
Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
方法1: 就用SpringBoot 3
如果 pom.xml 中spring-boot-starter-parent 的版本 需要 使用 3.0.0 或以上,则 mybatis-plus-boot-starter 的版本必须为 3.5.3 或以上。对应如下两部分代码:
<parent> 部分:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.1</version>
<relativePath/>
</parent><dependency> 部分:
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3</version>
</dependency>方法2:不需要使用SpringBoot 3
如果 pom.xml 中spring-boot-starter-parent 的版本 不需要 使用 3.0.0 或以上,则可以将其版本改为 2.7.8 即 SpringBoot 2 版本, mybatis-plus-boot-starter 的版本无需使用最新的 3.5.3(mybatis-plus 在 3.4 和 3.5 版本之间有较大变化,按需使用即可)。
<parent> 部分:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.8</version>
<relativePath/>
</parent><dependency> 部分:
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3</version>
</dependency>以上就是MyBatis-plus报错Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required的解决方法的详细内容,更多关于MyBatis-plus报错sqlSessionFactory的资料请关注脚本之家其它相关文章!
相关文章
Spring Boot RabbitMQ 延迟消息实现完整版示例
本篇文章主要介绍了Spring Boot RabbitMQ 延迟消息实现完整版示例,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-05-05
基于SpringBoot+MySQL+Vue实现文件共享系统
我们每天要传海报、视频、文案,以前靠微信群、U盘、邮箱来回传,问题一大堆, 于是,我用SpringBoot+MySQL+Vue搞了个文件共享系统,同时加了用户空间限额,本文通过代码示例介绍的非常详细,需要的朋友可以参考下2025-08-08


最新评论