Skip to content

Commit 8150fc9

Browse files
committed
[代码优化](v2.6):使用 testOnBorrow 检测连接有效性
1 parent e0fe1b9 commit 8150fc9

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

eladmin-system/src/main/resources/config/application-dev.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ spring:
1616
# 获取连接超时时间
1717
max-wait: 5000
1818
# 连接有效性检测时间
19-
time-between-eviction-runs-millis: 60000
19+
time-between-eviction-runs-millis: 1800000
2020
# 连接在池中最小生存的时间
21-
min-evictable-idle-time-millis: 300000
22-
# 连接在池中最大生存的时间
23-
max-evictable-idle-time-millis: 900000
24-
test-while-idle: true
25-
test-on-borrow: false
21+
min-evictable-idle-time-millis: 1800000
22+
test-while-idle: false
23+
test-on-borrow: true
2624
test-on-return: false
2725
# 检测连接是否有效
2826
validation-query: select 1

eladmin-system/src/main/resources/config/application-prod.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ spring:
1616
# 获取连接超时时间
1717
max-wait: 5000
1818
# 连接有效性检测时间
19-
time-between-eviction-runs-millis: 60000
19+
time-between-eviction-runs-millis: 1800000
2020
# 连接在池中最小生存的时间
21-
min-evictable-idle-time-millis: 300000
22-
# 连接在池中最大生存的时间
23-
max-evictable-idle-time-millis: 900000
24-
test-while-idle: true
25-
test-on-borrow: false
21+
min-evictable-idle-time-millis: 1800000
22+
test-while-idle: false
23+
test-on-borrow: true
2624
test-on-return: false
2725
# 检测连接是否有效
2826
validation-query: select 1

0 commit comments

Comments
 (0)