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

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

springboot+mybatisplus配置多个mapper路径

配置总共分两步:

第一步 :

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

springboot+mybatisplus配置多个mapper路径

第二步:

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

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

 

相关文章:

  • 2021-10-31
  • 2021-07-07
  • 2021-11-06
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2021-09-20
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-06-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案