Commit 2ed45685 by wuchengwu

新增查询数据源

parent 2064a3a0
......@@ -31,6 +31,20 @@ public class DataSourceConfig {
return baseDbProperties().initializeDataSourceBuilder().build();
}
@Bean(name="xzxtcxdbProperties")
@Qualifier("xzxtcxdb")
@ConfigurationProperties(prefix = "spring.datasource.xzxtcxdb")
public DataSourceProperties xzxtcxdbProperties(){
return new DataSourceProperties();
}
@Bean(name="xzxtcxdb")
@Qualifier("xzxtcxdb")
@ConfigurationProperties(prefix = "spring.datasource.xzxtcxdb")
public DataSource setxzxtcxdbDataSource(){
return xzxtcxdbProperties().initializeDataSourceBuilder().build();
}
@Bean(name="amsisdbProperties")
@Qualifier("amsisdb")
@ConfigurationProperties(prefix = "spring.datasource.amsisdb")
......
package com.founder.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
/**
* @author www
* @DateTime: 2020/6/9 3:14 下午
*/
@Configuration
@MapperScan(basePackages = {"com.founder.xzxtcxDao"},sqlSessionFactoryRef = "xzxtcxSqlSessionFactory")
public class MybatisXzxtcxDbConfig {
static final String MAPPER_LOCATION = "classpath:mapper/*.xml";
@Autowired
@Qualifier("xzxtcxdb")
private DataSource xzxtcxdb;
@Bean(name="xzxtcxSqlSessionFactory")
public SqlSessionFactory xzxtcxSqlSessionFactory() throws Exception {
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
factoryBean.setDataSource(xzxtcxdb);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
return factoryBean.getObject();
}
@Bean(name="xzxtcxSqlSessionTemplate")
public SqlSessionTemplate xzxtcxSqlSessionTemplate() throws Exception {
return new SqlSessionTemplate(xzxtcxSqlSessionFactory());
}
}
......@@ -23,6 +23,12 @@ spring.datasource.xzxtdb.username=XZXT
spring.datasource.xzxtdb.password=XZXT
spring.datasource.xzxtdb.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.xzxtdb.type: com.alibaba.druid.pool.DruidDataSource
#协同查询配置
spring.datasource.xzxtcxdb.url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
spring.datasource.xzxtcxdb.username=XZXT
spring.datasource.xzxtcxdb.password=XZXT
spring.datasource.xzxtcxdb.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.xzxtcxdb.type: com.alibaba.druid.pool.DruidDataSource
#指纹数据源配置
spring.datasource.amsisdb.url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
spring.datasource.amsisdb.username=XZXT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment