|
|
@@ -59,6 +59,12 @@ public class DruidDBConfiguration {
|
|
|
|
|
|
private String connectionProperties;
|
|
|
|
|
|
+ private boolean removeAbandoned;
|
|
|
+
|
|
|
+ private int removeAbandonedTimeout;
|
|
|
+
|
|
|
+ private boolean logAbandoned;
|
|
|
+
|
|
|
@Bean
|
|
|
@Primary
|
|
|
public DataSource dataSource() {
|
|
|
@@ -80,6 +86,10 @@ public class DruidDBConfiguration {
|
|
|
dataSource.setTestWhileIdle(testWhileIdle);
|
|
|
dataSource.setTestOnBorrow(testOnBorrow);
|
|
|
dataSource.setTestOnReturn(testOnReturn);
|
|
|
+ // 设置闲置连接断开
|
|
|
+ dataSource.setRemoveAbandoned(removeAbandoned);
|
|
|
+ dataSource.setRemoveAbandonedTimeout(removeAbandonedTimeout);
|
|
|
+ dataSource.setLogAbandoned(logAbandoned);
|
|
|
dataSource.setTimeBetweenLogStatsMillis(timeBetweenLogStatsMillis);
|
|
|
dataSource.setPoolPreparedStatements(poolPreparedStatements);
|
|
|
dataSource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
|