mybatis-plus自定义Mapper.xml文件路径

mybatis-plus自定义Mapper.xml文件路径
彼岸的風- mybatis-plus 是有默认的.xml文件路径的,路径为/mapper/**/*.xml,我们现在想自定义的它的位置而不是在resources目录下创建,最后的解构如下图
- 首先在项目的 pom 文件中的 build 标签里添加下面这段配置
1
2
3
4
5
6
7
8
9<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources> - 然后打开项目的 application.yml 配置文件,给 mapper-locations 添加路径配置
1
mapper-locations: com/fu99999/note/mapper/xml/*.xml
最后重启项目,大功告成。
评论
匿名评论隐私政策
✅ 你无需删除空行,直接评论以获取最佳展示效果