MyBatis-Plus 使用xml文件

原文链接: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文件夹内路径配置方式

posted @ 2020-09-09 08:58  枫树湾河桥  阅读(24391)  评论(1编辑  收藏  举报
Live2D