Commit 8e3d76d0 by s_guodong

修改数据库配置

parent 1da7771f
...@@ -4,8 +4,7 @@ server: ...@@ -4,8 +4,7 @@ server:
context-path: /gjjs/business context-path: /gjjs/business
spring: spring:
datasource: ipsnew:
druid:
driver-class-name: oracle.jdbc.driver.OracleDriver driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@114.115.138.98:9400:XE url: jdbc:oracle:thin:@114.115.138.98:9400:XE
username: ipsnew username: ipsnew
...@@ -24,7 +23,7 @@ spring: ...@@ -24,7 +23,7 @@ spring:
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒 # 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000 minEvictableIdleTimeMillis: 300000
validationQuery: select 1 from dual # validationQuery: select 1 from dual
testWhileIdle: true testWhileIdle: true
testOnBorrow: false testOnBorrow: false
testOnReturn: false testOnReturn: false
...@@ -47,222 +46,6 @@ spring: ...@@ -47,222 +46,6 @@ spring:
datasource1:
driver-class-name: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@114.115.138.98:9400:XE
username: ipsnew
password: ipsnew
type: com.alibaba.druid.pool.DruidDataSource
# 下面为连接池的补充设置,应用到上面所有数据源中
# 初始化大小,最小,最大
# druid 配置: https://github.com/alibaba/druid/wiki/
#初始化链接数
initialSize: 1
minIdle: 1
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: select 1 from dual
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,stat用于监控界面,'wall'用于防火墙防御sql注入, slf4j用于druid记录sql日志
filters: stat,slf4j
#,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 合并多个DruidDataSource的监控数据
useGlobalDataSourceStat: false
datasource2:
url: jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: 123456
#driverClassName: com.mysql.jdbc.Driver
driver-class-name: com.mysql.jdbc.Driver
eibs:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://192.168.0.110:55435/eibs?useUnicode=true&characterEncoding=UTF-8
username: postgres
password: postgres
type: com.alibaba.druid.pool.DruidDataSource
# 下面为连接池的补充设置,应用到上面所有数据源中
# 初始化大小,最小,最大
# druid 配置: https://github.com/alibaba/druid/wiki/
#初始化链接数
initialSize: 1
minIdle: 1
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# validationQuery: select 1 from dual
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,stat用于监控界面,'wall'用于防火墙防御sql注入, slf4j用于druid记录sql日志
filters: stat,slf4j
#,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 合并多个DruidDataSource的监控数据
useGlobalDataSourceStat: false
swd:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://192.168.0.110:55435/swd?useUnicode=true&characterEncoding=UTF-8
username: postgres
password: postgres
type: com.alibaba.druid.pool.DruidDataSource
# 下面为连接池的补充设置,应用到上面所有数据源中
# 初始化大小,最小,最大
# druid 配置: https://github.com/alibaba/druid/wiki/
#初始化链接数
initialSize: 1
minIdle: 1
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# validationQuery: select 1 from dual
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,stat用于监控界面,'wall'用于防火墙防御sql注入, slf4j用于druid记录sql日志
filters: stat,slf4j
#,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 合并多个DruidDataSource的监控数据
useGlobalDataSourceStat: false
fxd:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://192.168.0.110:55435/fxd?useUnicode=true&characterEncoding=UTF-8
username: postgres
password: postgres
type: com.alibaba.druid.pool.DruidDataSource
# 下面为连接池的补充设置,应用到上面所有数据源中
# 初始化大小,最小,最大
# druid 配置: https://github.com/alibaba/druid/wiki/
#初始化链接数
initialSize: 1
minIdle: 1
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# validationQuery: select 1 from dual
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,stat用于监控界面,'wall'用于防火墙防御sql注入, slf4j用于druid记录sql日志
filters: stat,slf4j
#,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 合并多个DruidDataSource的监控数据
useGlobalDataSourceStat: false
erd:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://192.168.0.110:55435/erd?useUnicode=true&characterEncoding=UTF-8
username: postgres
password: postgres
type: com.alibaba.druid.pool.DruidDataSource
# 下面为连接池的补充设置,应用到上面所有数据源中
# 初始化大小,最小,最大
# druid 配置: https://github.com/alibaba/druid/wiki/
#初始化链接数
initialSize: 1
minIdle: 1
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# validationQuery: select 1 from dual
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,stat用于监控界面,'wall'用于防火墙防御sql注入, slf4j用于druid记录sql日志
filters: stat,slf4j
#,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 合并多个DruidDataSource的监控数据
useGlobalDataSourceStat: false
ryd:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://192.168.0.110:55435/ryd?useUnicode=true&characterEncoding=UTF-8
username: postgres
password: postgres
type: com.alibaba.druid.pool.DruidDataSource
# 下面为连接池的补充设置,应用到上面所有数据源中
# 初始化大小,最小,最大
# druid 配置: https://github.com/alibaba/druid/wiki/
#初始化链接数
initialSize: 1
minIdle: 1
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# validationQuery: select 1 from dual
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,stat用于监控界面,'wall'用于防火墙防御sql注入, slf4j用于druid记录sql日志
filters: stat,slf4j
#,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 合并多个DruidDataSource的监控数据
useGlobalDataSourceStat: false
envConfig: envConfig:
rootPath: workRoot rootPath: workRoot
......
...@@ -20,76 +20,14 @@ import java.util.HashMap; ...@@ -20,76 +20,14 @@ import java.util.HashMap;
@Configuration @Configuration
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class}) @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class DataSourceConfiguration { public class DataSourceConfiguration {
/**
* 数据源1
*/
@Bean(name = "datasource1")
@Qualifier("datasource1")
@ConfigurationProperties(prefix = "spring.datasource1")
public DruidDataSource datasource1() {
return new DruidDataSource();
}
/**
* 数据源2
*/
@Bean(name = "datasource2")
@Qualifier("datasource2")
@ConfigurationProperties(prefix = "spring.datasource2")
public DruidDataSource datasource2() {
return new DruidDataSource();
}
/**
* 数据源eibs
*/
@Bean(name = "eibs")
@Qualifier("eibs")
@ConfigurationProperties(prefix = "spring.eibs")
public DruidDataSource eibs() {
return new DruidDataSource();
}
/**
* 数据源swd
*/
@Bean(name = "swd")
@Qualifier("swd")
@ConfigurationProperties(prefix = "spring.swd")
public DruidDataSource swd() {
return new DruidDataSource();
}
/**
* 数据源fxd
*/
@Bean(name = "fxd")
@Qualifier("fxd")
@ConfigurationProperties(prefix = "spring.fxd")
public DruidDataSource fxd() {
return new DruidDataSource();
}
/**
* 数据源erd
*/
@Bean(name = "erd")
@Qualifier("erd")
@ConfigurationProperties(prefix = "spring.erd")
public DruidDataSource erd() {
return new DruidDataSource();
}
/** /**
* 数据源ryd * 数据源ipsnew
*/ */
@Bean(name = "ryd") @Bean(name = "ipsnew")
@Qualifier("ryd") @Qualifier("ipsnew")
@ConfigurationProperties(prefix = "spring.ryd") @ConfigurationProperties(prefix = "spring.ipsnew")
public DruidDataSource ryd() { public DruidDataSource ipsnew() {
return new DruidDataSource(); return new DruidDataSource();
} }
...@@ -99,15 +37,9 @@ public class DataSourceConfiguration { ...@@ -99,15 +37,9 @@ public class DataSourceConfiguration {
public DataSource dynamicDataSource() { public DataSource dynamicDataSource() {
DynamicDataSource dynamicDataSource = new DynamicDataSource(); DynamicDataSource dynamicDataSource = new DynamicDataSource();
dynamicDataSource.myMap = new HashMap<>(); dynamicDataSource.myMap = new HashMap<>();
dynamicDataSource.myMap.put("datasource1", datasource1()); dynamicDataSource.myMap.put("ipsnew", ipsnew());
dynamicDataSource.myMap.put("datasource2", datasource2());
dynamicDataSource.myMap.put("eibs", eibs());
dynamicDataSource.myMap.put("swd", swd());
dynamicDataSource.myMap.put("fxd", fxd());
dynamicDataSource.myMap.put("erd", erd());
dynamicDataSource.myMap.put("ryd", ryd());
dynamicDataSource.setTargetDataSources(dynamicDataSource.myMap); dynamicDataSource.setTargetDataSources(dynamicDataSource.myMap);
dynamicDataSource.setDefaultTargetDataSource(eibs()); dynamicDataSource.setDefaultTargetDataSource(ipsnew());
DynamicDataSourceContextHolder.dataSourceIds.addAll(dynamicDataSource.myMap.keySet()); DynamicDataSourceContextHolder.dataSourceIds.addAll(dynamicDataSource.myMap.keySet());
return dynamicDataSource; return dynamicDataSource;
} }
......
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