關於引入mybatis-plus-boot-starter之后產生的坑


記錄一個深坑問題,

springboot項目,版本2.1.6,整合了mybatis

pom引入了下面這個jar之后產生了問題:springboot Invalid bound statement (not found): xxxx.xxxx.xxxMapper/queryList

<dependency>
  <groupId>com.baomidou</groupId>
  <artifactId>mybatis-plus-boot-starter</artifactId>
  <version>2.3</version>
</dependency>

一開始以為是application配置文件里xml路徑設置錯誤,但不是這個原因

mybatis:
  mapper-locations: classpath*:/mapper/*Mapper.xml
  type-aliases-package: com.wxxwjef.cryptolalia.core.entity

啟動類也加上了注解@MapperScan("com.wxxwjef.cryptolalia.core.mapper*")

無從查起

最終發現把mybatis-plus-boot-starter替換成mybatis-plus總jar就沒有這個問題了

<dependency>
  <groupId>com.baomidou</groupId>
  <artifactId>mybatis-plus</artifactId>
  <version>2.1.8</version>
</dependency>

可能是我對於mybatis-plus-boot-starter的使用配置注解方法沒有了解清楚。

這兩個jar在對於掃描實體mapper等文件的方式上或存在差異,用通用的mybatis配置方法無法實現。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM