好久没写demo项目了,启动项目时报找不到xml的sql
结构如上
在pom.xml中将xml文件打包进去就行了,默认只会打包java相关文件.添加以下配置
<!-- 项目打包时会将java目录中的*.xml文件也进行打包 -->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
yml文件中也配置
mybatis-plus:
mapper-locations: [ "classpath:/com/a/mapper/xml/**/*.xml","classpath:/com/a/mapper/xml/*.xml" ]