如果mapper没有在resource目录下需要在pom文件build标签中添加以下代码
<resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.class</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources>
该配置和配置文件中的(mapper-locations: classpath*:/com/mybatis/**/*Mapper.xml)必须同时存在
mybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl mapper-locations: classpath*:/com/mybatis/**/*Mapper.xml
如果没有扫描到yml注意启动项目时打印的 ”Property 'mapperLocations' was not specified.”