|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
package com.example.config;
|
|
|
|
|
package ${basePackage}.config;
|
|
|
|
|
|
|
|
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
|
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
|
|
|
@ -14,7 +14,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
@MapperScan(basePackages = {"com.example.*.twoMpr"}, sqlSessionFactoryRef = "twoSqlSessionFactory")
|
|
|
|
|
@MapperScan(basePackages = {"${basePackage}.*.twoMpr"}, sqlSessionFactoryRef = "twoSqlSessionFactory")
|
|
|
|
|
public class MapperTwoConfig {
|
|
|
|
|
@Bean(name = "TwoDataSource")
|
|
|
|
|
@ConfigurationProperties(prefix = "spring.datasource.two")
|
|
|
|
@ -31,7 +31,7 @@ public class MapperTwoConfig {
|
|
|
|
|
public SqlSessionFactory basicSqlSessionFactory(@Qualifier("twoDataSource") DataSource basicDataSource) throws Exception {
|
|
|
|
|
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
|
|
|
|
|
factoryBean.setDataSource(basicDataSource);
|
|
|
|
|
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:com/example/**/twoMpr/*.xml"));
|
|
|
|
|
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:**/twoMpr/*.xml"));
|
|
|
|
|
return factoryBean.getObject();
|
|
|
|
|
}
|
|
|
|
|
}
|