springboot,mybatis多模块项目中两个项目的Mybatis中resultMap如何共享(每个mapper.xml中都要重复定义相同的resultMap吗)
1.如果A项目需要引用B项目的resultMap,则在A的pom.xml文件中添加B项目的引用
<dependency>
<groupId>cn.com.yawei.hotline</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
如图:我引用的是叫common的项目
2.在A的yml文件里面添加配置,扫描B的xml
mybatis:
mapper-locations: classpath*:mapper/*.xml
找到mybatis配置,原来的classpath:mapper/.xml改为classpath※:mapper/.xml,即在calsspath后面加上※星号