Mybatis-plus 多数据源配置时失效
作者:
M_ENG | 来源:发表于
2020-07-01 16:13 被阅读0次@Bean
public SqlSessionFactory sqlSessionFactoryRecordTdDb() throws Exception {
SqlSessionFactoryBean factoryBean = newSqlSessionFactoryBean();
factoryBean.setDataSource(recordTdDb);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/record_td_db/*.xml"));
return factoryBean.getObject();
}
上面的 SqlSessionFactoryBean 替换成 MybatisSqlSessionFactoryBean
@Bean
public SqlSessionFactory sqlSessionFactoryRecordTdDb() throws Exception {
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
factoryBean.setDataSource(recordTdDb);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/record_td_db/*.xml"));
return factoryBean.getObject();
}
本文标题:Mybatis-plus 多数据源配置时失效
本文链接:https://www.haomeiwen.com/subject/fechqktx.html
网友评论