springboot+mybatisplus配置多个mapper路径


springboot项目有时会涉及多数据源,因为我们通常每个数据源创建不同的包路径,mapper.xml的路径也不一样,这个时候就需要引入多个路径。

数据源1,mapper接口路径在 mapper包下面,mapper.xml 路径在 resources/mappers/下面; 数据源2,mapper接口路径在 mapper/other包下面,mapper.xml 路径在 resources/mappers/other下面:

配置总共分两步:

第一步 :

在mybatisplus配置类里面修改扫描包路径:

第二步:

修项目的application.yml配置文件中配置mapper.xml路径如下:

mybatis-plus:
mapper-locations: classpath*:mapper/*.xml,classpath*:mapper/other/*.xml

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM