1.问题
dao层的接口 找不到 mapper层对应的xml

找不到

2.解决方法
1.启动类加MapperScan
@MapperScan("com.ybj.mpm.system.authentication.dao")
2.yml配置xml位置
mybatis-plus:
mapper-locations: classpath:com/ybj/mpm/system/authentication/mapping/*.xml
3.pom配置resource
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/mapping/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
本文介绍了解决在使用MyBatis Plus框架时遇到的DAO层接口找不到对应XML映射文件的问题,提供了三种解决方案:1. 在启动类中添加@MapperScan注解;2. 通过yml配置文件指定XML映射文件的位置;3. 在pom.xml中配置资源,确保XML映射文件被正确加载。
1万+

被折叠的 条评论
为什么被折叠?



