diff --git a/CHANGELOG.md b/CHANGELOG.md index 36587e22b..e46170c6d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # 🚀Changelog ------------------------------------------------------------------------------------------------------------- -# 5.8.25(2023-12-29) +# 5.8.25(2024-01-02) ### 🐣新特性 * 【core 】 WatchServer新增通过Path获取WatchKey方法(pr#1145@Gitee) @@ -11,6 +11,7 @@ * 【core 】 修复StrJoin当append内容后调用length()会出现空指针问题(issue#3444@Github) * 【core 】 修复PostgreSQL、H2使用upsert字段大小写问题(issue#I8PB4X@Gitee) * 【core 】 修复RandomUtil.randomInt,RandomUtil.randomLong边界问题(pr#3450@Github) +* 【db 】 修复Druid连接池无法设置部分属性问题(issue#I8STFC@Gitee) ------------------------------------------------------------------------------------------------------------- # 5.8.24(2023-12-23) diff --git a/hutool-db/src/main/java/cn/hutool/db/ds/druid/DruidDSFactory.java b/hutool-db/src/main/java/cn/hutool/db/ds/druid/DruidDSFactory.java index fde873fbd..b3146effd 100644 --- a/hutool-db/src/main/java/cn/hutool/db/ds/druid/DruidDSFactory.java +++ b/hutool-db/src/main/java/cn/hutool/db/ds/druid/DruidDSFactory.java @@ -77,6 +77,38 @@ public class DruidDSFactory extends AbstractDSFactory { ds.setBreakAfterAcquireFailure(druidProps.getBool(breakAfterAcquireFailureKey)); } + // issue#I8STFC 补充 + // validationQueryTimeout + final String validationQueryTimeout = "druid.validationQueryTimeout"; + if(druidProps.containsKey(validationQueryTimeout)){ + ds.setValidationQueryTimeout(druidProps.getInt(validationQueryTimeout)); + } + // queryTimeout + final String queryTimeout = "druid.queryTimeout"; + if(druidProps.containsKey(queryTimeout)){ + ds.setQueryTimeout(druidProps.getInt(queryTimeout)); + } + // connectTimeout + final String connectTimeout = "druid.connectTimeout"; + if(druidProps.containsKey(connectTimeout)){ + ds.setConnectTimeout(druidProps.getInt(connectTimeout)); + } + // socketTimeout + final String socketTimeout = "druid.socketTimeout"; + if(druidProps.containsKey(socketTimeout)){ + ds.setSocketTimeout(druidProps.getInt(socketTimeout)); + } + // transactionQueryTimeout + final String transactionQueryTimeout = "druid.transactionQueryTimeout"; + if(druidProps.containsKey(transactionQueryTimeout)){ + ds.setTransactionQueryTimeout(druidProps.getInt(transactionQueryTimeout)); + } + // loginTimeout + final String loginTimeout = "druid.loginTimeout"; + if(druidProps.containsKey(loginTimeout)){ + ds.setLoginTimeout(druidProps.getInt(loginTimeout)); + } + // 检查关联配置,在用户未设置某项配置时,设置默认值 if (null == ds.getValidationQuery()) { // 在validationQuery未设置的情况下,以下三项设置都将无效