启动类上加上 @MapperScan指定mapper位置
配置文件指定xml文件所在位置
mybatis:
mapper-locations: classpath:/mapper/**/*.xml
在SpringBoot应用中,使用@MapperScan注解可以指定Mapper接口的位置,而mybatis.mapper-locations配置则用于指定XML映射文件的位置,通常是classpath下的mapper目录。这样确保了MyBatis能正确扫描到接口和对应的XML配置,实现数据访问。
启动类上加上 @MapperScan指定mapper位置
配置文件指定xml文件所在位置
mybatis:
mapper-locations: classpath:/mapper/**/*.xml
745
234
484
420

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