当前使用版本(必填,否则不予处理)

jdk 1.8 spring-boot-starter-parent 2.5.7 mybatis-plus-boot-starter 3.5.1/3.3.1 druid-spring-boot-starter 1.1.24 mysql.version 8.0.17

该问题是如何引起的?(确定最新版也有问题再提!!!)

springboot项目启动会有警告 1. No MyBatis mapper was found in com. package. Please check your configuration. 通过源码发现项目启动过程中执行了两次doScan的操作 即使添加注解@MapperScan(basePackages = "com..mapper") 首先doScan会对包 com..mapper进行一次扫描,还会对com.包再进行一次扫描,然后导致上述异常

  1. Skipping MapperFactoryBean with name 'Mapper' and 'com.*.mapper.*Mapper' mapperInterface. Bean already defined with the same name! 在Mapper接口上增加@Mapper注解,启动类上没有@MapperScan注解,则会抛出上述警告 如果删除@Mapper注解,在启动类上增加@MapperScan注解,这个警告就会消失 (麻烦解释一下是什么原因导致的,能否只添加@Mapper注解且不警告)

重现步骤(如果有就写完整)

上述已完成重现步骤

报错信息

  1. No MyBatis mapper was found in '[com.***]' package. Please check your configuration.
  2. Skipping MapperFactoryBean with name 'Mapper' and 'com.*.mapper.*Mapper' mapperInterface. Bean already defined with the same name! MyBatis-Plus springboot项目启动出现警告现象

附带配置文件截图 MyBatis-Plus springboot项目启动出现警告现象

Comment From: miemieYaho

这都是mybatis的知识,去百度吧

Comment From: InsaneLighter

这都是mybatis的知识,去百度吧

整合pagehelper-spring-boot-starter version1.2.5 会出现以上情况 更换版本为1.4.2则警告消失

不整合pagehelper-spring-boot-starter 也没有该情况出现