原文鏈接:https://my.oschina.net/u/4157150/blog/4282150
mybatis plus使用mapper.xml文件注意事項。
步驟1 加載dao文件,即dao接口文件
加載方式1.在dao接口上增加mapper注解
@Mapper public interface AuthFunctionRepo extends BaseRepository<AuthFunction>
加載方式2.在啟動類加掃描注解
@MapperScan(basePackages = {"com.yxl.smart.auth.repo"}) 或者@MapperScan("com.yxl.smart.auth.repo")
兩種方式配置一種即可。重復配置也不會報錯。
步驟2 加載mapper.xml文件
在屬性文件中指定xml文件路徑。
mybatis-plus:
mapper-locations: classpath:com/yxl/smart/auth/repo/*.xml
xml文件在resources文件夾內路徑配置方式