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 或以上。對應(yīng)如下兩部分代碼:
<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的解決方法的詳細(xì)內(nèi)容,更多關(guān)于MyBatis-plus報錯sqlSessionFactory的資料請關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
Spring Boot RabbitMQ 延遲消息實現(xiàn)完整版示例
本篇文章主要介紹了Spring Boot RabbitMQ 延遲消息實現(xiàn)完整版示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-05-05
Java JFinal框架中實現(xiàn)添加定時任務(wù)功能詳解
這篇文章主要為大家詳細(xì)介紹了如何在JFinal框架項目中添加定時任務(wù)的功能,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2025-02-02
基于SpringBoot+MySQL+Vue實現(xiàn)文件共享系統(tǒng)
我們每天要傳海報、視頻、文案,以前靠微信群、U盤、郵箱來回傳,問題一大堆, 于是,我用SpringBoot+MySQL+Vue搞了個文件共享系統(tǒng),同時加了用戶空間限額,本文通過代碼示例介紹的非常詳細(xì),需要的朋友可以參考下2025-08-08

