springboot集成mybatis-plus无法扫描到mapper.xml,因为xml文件没有在resources文件下,无法被扫描到所以需要修改配置

Property 'mapperLocations' was not specified or no matching resources found

 修改yml文件

mybatis-plus:
  mapper-locations: classpath*:**/mapper/xml*/*.xml*   #配置正确的文件路径
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  global-config:
    banner: false

 pom文件

<build>
   <resources>
      <resource>
         <!-- xml放在java目录下-->
         <directory>src/main/java</directory>
         <includes>
            <include>**/*.xml</include>
         </includes>
      </resource>
      <!--指定资源的位置(xml放在resources下,可以不用指定)-->
      <resource>
         <directory>src/main/resources</directory>
      </resource>
   </resources>
</build>

猜你喜欢

转载自blog.csdn.net/weixin_57197500/article/details/131507675