springboot或者spring項目經常會引用其它項目,把其它項目的Jar包加進來,因為每個項目的包路徑不一樣,mapper.xml的路徑也不一樣,這個時候就需要引入多個路徑。
項目A,mapper.xml 路徑在 resources/mappers/push 下面
項目B,mapper.xml 路徑再 resources/mappers/下面
項目A引用了項目B,把項目B的jar包加入到pom文件中了
那么項目A的application.properties配置文件中配置mapper.xml路徑如下:
mybatis.mapper-locations=classpath:mappers/push/*.xml,classpath*:/mappers/*.xml
注意點:在classpath后面的 * 必不可少,缺少型號的話后面的通配符不起作用。
**表示可以表示任意多級目錄。
轉自:https://blog.csdn.net/zxl646801924/article/details/88669809