Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
3696c2fb
Commit
3696c2fb
authored
Jun 02, 2019
by
zhengjie
Browse files
优化 druid 连接池,启动类添加@EnableAsync注解,开启Spring boot 异步支持
parent
94946018
Changes
3
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/AppRun.java
View file @
3696c2fb
...
@@ -4,6 +4,7 @@ import me.zhengjie.utils.SpringContextHolder;
...
@@ -4,6 +4,7 @@ import me.zhengjie.utils.SpringContextHolder;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker
;
import
org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker
;
...
@@ -11,6 +12,7 @@ import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBr
...
@@ -11,6 +12,7 @@ import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBr
* @author jie
* @author jie
* @date 2018/11/15 9:20:19
* @date 2018/11/15 9:20:19
*/
*/
@EnableAsync
@SpringBootApplication
@SpringBootApplication
@EnableTransactionManagement
@EnableTransactionManagement
@EnableWebSocketMessageBroker
@EnableWebSocketMessageBroker
...
...
eladmin-system/src/main/resources/config/application-dev.yml
View file @
3696c2fb
...
@@ -8,27 +8,23 @@ spring:
...
@@ -8,27 +8,23 @@ spring:
username
:
root
username
:
root
password
:
123456
password
:
123456
# 初始化连接大小
# 初始化配置
initial-size
:
5
initial-size
:
3
# 最小空闲连接数
# 最小连接数
min-idle
:
5
min-idle
:
3
max-active
:
20
# 最大连接数
max-wait
:
30000
max-active
:
15
# 可关闭的空闲连接间隔时间
# 获取连接超时时间
time-between-eviction-runs-millis
:
60000
max-wait
:
5000
# 配置连接在池中的最小生存时间
# 连接有效性检测时间
min-evictable-idle-time-millis
:
300000
time-between-eviction-runs-millis
:
90000
validation-query
:
select '1' from dual
# 最大空闲时间
min-evictable-idle-time-millis
:
1800000
test-while-idle
:
true
test-while-idle
:
true
test-on-borrow
:
false
test-on-borrow
:
false
test-on-return
:
false
test-on-return
:
false
# 打开PSCache,并且指定每个连接上PSCache的大小
pool-prepared-statements
:
true
max-open-prepared-statements
:
20
max-pool-prepared-statement-per-connection-size
:
20
# 配置监控统计拦截的filters
# 配置监控统计拦截的filters
filters
:
stat
filters
:
stat
stat-view-servlet
:
stat-view-servlet
:
url-pattern
:
/druid/*
url-pattern
:
/druid/*
reset-enable
:
false
reset-enable
:
false
...
...
eladmin-system/src/main/resources/config/application-prod.yml
View file @
3696c2fb
...
@@ -8,24 +8,21 @@ spring:
...
@@ -8,24 +8,21 @@ spring:
username
:
root
username
:
root
password
:
123456
password
:
123456
# 初始化连接大小
# 初始化配置
initial-size
:
5
initial-size
:
3
# 最小空闲连接数
# 最小连接数
min-idle
:
5
min-idle
:
3
max-active
:
20
# 最大连接数
max-wait
:
30000
max-active
:
15
# 可关闭的空闲连接间隔时间
# 获取连接超时时间
time-between-eviction-runs-millis
:
60000
max-wait
:
5000
# 配置连接在池中的最小生存时间
# 连接有效性检测时间
min-evictable-idle-time-millis
:
300000
time-between-eviction-runs-millis
:
90000
validation-query
:
select '1' from dual
# 最大空闲时间
min-evictable-idle-time-millis
:
1800000
test-while-idle
:
true
test-while-idle
:
true
test-on-borrow
:
false
test-on-borrow
:
false
test-on-return
:
false
test-on-return
:
false
# 打开PSCache,并且指定每个连接上PSCache的大小
pool-prepared-statements
:
true
max-open-prepared-statements
:
20
max-pool-prepared-statement-per-connection-size
:
20
# 配置监控统计拦截的filters
# 配置监控统计拦截的filters
filters
:
stat
filters
:
stat
...
...
Write
Preview
Supports
Markdown
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