@Primary
@Bean("ds1SqlSessionFactory")
public SqlSessionFactory ds1SqlSessionFactory(@Qualifier("ds1DataSource") DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();
sqlSessionFactory.setDataSource(dataSource);
MybatisConfiguration configuration = new MybatisConfiguration();
configuration.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class);
configuration.setJdbcTypeForNull(JdbcType.NULL);
configuration.setLogImpl(StdOutImpl.class);
sqlSessionFactory.setConfiguration(configuration);
sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().
getResources("classpath*:mapper/ds1/*.xml"));
sqlSessionFactory.setPlugins(new Interceptor[]{
new PaginationInterceptor(),
mybatisPlusInterceptor()
// .setFormat(true),
});
sqlSessionFactory.setGlobalConfig(new GlobalConfig().setBanner(false));
return sqlSessionFactory.getObject();
}
这里的路径写错了,少写了mapper这一层,还有就是在单元测试的h2数据源中没有配置多数据源导致install报错