Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjs-bd-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
s_guodong
gjjs-bd-common
Commits
8e3d76d0
Commit
8e3d76d0
authored
Jun 15, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据库配置
parent
1da7771f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
294 deletions
+9
-294
application-oracle.yml
gjjs-bd-business/src/main/resources/application-oracle.yml
+2
-219
DataSourceConfiguration.java
...illiance/mda/support/mybatis/DataSourceConfiguration.java
+7
-75
No files found.
gjjs-bd-business/src/main/resources/application-oracle.yml
View file @
8e3d76d0
...
...
@@ -4,8 +4,7 @@ server:
context-path
:
/gjjs/business
spring
:
datasource
:
druid
:
ipsnew
:
driver-class-name
:
oracle.jdbc.driver.OracleDriver
url
:
jdbc:oracle:thin:@114.115.138.98:9400:XE
username
:
ipsnew
...
...
@@ -24,7 +23,7 @@ spring:
timeBetweenEvictionRunsMillis
:
60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis
:
300000
validationQuery
:
select 1 from dual
#
validationQuery: select 1 from dual
testWhileIdle
:
true
testOnBorrow
:
false
testOnReturn
:
false
...
...
@@ -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
:
rootPath
:
workRoot
...
...
gjjs-bd-mybatis-support/src/main/java/com/brilliance/mda/support/mybatis/DataSourceConfiguration.java
View file @
8e3d76d0
...
...
@@ -20,76 +20,14 @@ import java.util.HashMap;
@Configuration
@EnableAutoConfiguration
(
exclude
=
{
DataSourceAutoConfiguration
.
class
})
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
"
)
@Qualifier
(
"
ryd
"
)
@ConfigurationProperties
(
prefix
=
"spring.
ryd
"
)
public
DruidDataSource
ryd
()
{
@Bean
(
name
=
"
ipsnew
"
)
@Qualifier
(
"
ipsnew
"
)
@ConfigurationProperties
(
prefix
=
"spring.
ipsnew
"
)
public
DruidDataSource
ipsnew
()
{
return
new
DruidDataSource
();
}
...
...
@@ -99,15 +37,9 @@ public class DataSourceConfiguration {
public
DataSource
dynamicDataSource
()
{
DynamicDataSource
dynamicDataSource
=
new
DynamicDataSource
();
dynamicDataSource
.
myMap
=
new
HashMap
<>();
dynamicDataSource
.
myMap
.
put
(
"datasource1"
,
datasource1
());
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
.
myMap
.
put
(
"ipsnew"
,
ipsnew
());
dynamicDataSource
.
setTargetDataSources
(
dynamicDataSource
.
myMap
);
dynamicDataSource
.
setDefaultTargetDataSource
(
eibs
());
dynamicDataSource
.
setDefaultTargetDataSource
(
ipsnew
());
DynamicDataSourceContextHolder
.
dataSourceIds
.
addAll
(
dynamicDataSource
.
myMap
.
keySet
());
return
dynamicDataSource
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment