关于引入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配置方法无法实现。

 

posted @ 2019-07-30 09:26  wxxwjef  阅读(21019)  评论(0编辑  收藏  举报