实现
- 将
RefreshMapperCache放置egrant-core模块下的com.iris.egrant.mybatis包中 - 在项目中的applicationContext-appDatabase.xml中增加以下配置
 
<bean id="refreshMapperCache" class="com.iris.egrant.mybatis.RefreshMapperCache" >
  <!-- 扫描的映射mapper.xml的文件路径 这个地方要注意mapper的文件,多数据源情况下,只能扫描自己数据源下的mapper,否则会报异常-->
  <property name="mapperLocations">
    <array>
      <value>classpath:/mapper/*Mapper.xml</value>
    </array>
  </property>
  <property name="sqlSessionFactory" ref="sqlSessionFactory"/>
  <!--默认关闭,开发需要开启时改为true-->
  <property name="enable" value="true"/>
</bean>
2021年8月22日大约 2 分钟
