diff --git a/CHANGELOG.md b/CHANGELOG.md
index e86e6478d..d957022b2 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,8 +6,11 @@
# 5.8.0.M5 (2022-04-27)
### ❌不兼容特性
+
### 🐣新特性
+
### 🐞Bug修复
+* 【db 】 修复RedisDS无法设置maxWaitMillis问题(issue#I54TZ9@Gitee)
-------------------------------------------------------------------------------------------------------------
diff --git a/hutool-core/src/main/java/cn/hutool/core/lang/tree/TreeUtil.java b/hutool-core/src/main/java/cn/hutool/core/lang/tree/TreeUtil.java
index 197394495..705cd1086 100644
--- a/hutool-core/src/main/java/cn/hutool/core/lang/tree/TreeUtil.java
+++ b/hutool-core/src/main/java/cn/hutool/core/lang/tree/TreeUtil.java
@@ -38,7 +38,8 @@ public class TreeUtil {
}
/**
- * 构建单root节点树
+ * 构建单root节点树
+ * 它会生成一个以指定ID为ID的空的节点,然后逐级增加子节点。
*
* @param ID类型
* @param list 源数据集合
@@ -63,7 +64,8 @@ public class TreeUtil {
}
/**
- * 构建单root节点树
+ * 构建单root节点树
+ * 它会生成一个以指定ID为ID的空的节点,然后逐级增加子节点。
*
* @param 转换的实体 为数据源里的对象类型
* @param ID类型
@@ -107,7 +109,8 @@ public class TreeUtil {
}
/**
- * 构建单root节点树
+ * 构建单root节点树
+ * 它会生成一个以指定ID为ID的空的节点,然后逐级增加子节点。
*
* @param 转换的实体 为数据源里的对象类型
* @param ID类型
@@ -137,7 +140,8 @@ public class TreeUtil {
}
/**
- * 单点树构建,按照权重排序
+ * 单点树构建,按照权重排序
+ * 它会生成一个以指定ID为ID的空的节点,然后逐级增加子节点。
*
* @param ID类型
* @param map 源数据Map
diff --git a/hutool-core/src/test/java/cn/hutool/core/lang/tree/Issue2279Test.java b/hutool-core/src/test/java/cn/hutool/core/lang/tree/Issue2279Test.java
new file mode 100644
index 000000000..ad4a63004
--- /dev/null
+++ b/hutool-core/src/test/java/cn/hutool/core/lang/tree/Issue2279Test.java
@@ -0,0 +1,49 @@
+package cn.hutool.core.lang.tree;
+
+import cn.hutool.core.collection.ListUtil;
+import lombok.Data;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+public class Issue2279Test {
+
+ @Test
+ public void buildSingleTest() {
+ List list = ListUtil.of(
+ // 模拟数据
+ new TestTree(1, 0, 1, 1),
+ new TestTree(2, 1, 2, 2),
+ new TestTree(3, 1, 3, 3),
+ new TestTree(4, 2, 4, 4)
+ );
+
+ List> stringTree = TreeUtil.build(list, "0",
+ (object, treeNode) -> {
+ treeNode.setId(object.getId());
+ treeNode.setName(object.getName());
+ treeNode.setParentId(object.getPid());
+ treeNode.putExtra("extra1",object.getExtra1());
+ }
+ );
+
+ final Tree result = stringTree.get(0);
+ Assert.assertEquals(2, result.getChildren().size());
+ }
+
+ @Data
+ static class TestTree {
+ private String id;
+ private String pid;
+ private String name;
+ private String extra1;
+
+ public TestTree(int id, int pid, int name, int extra1) {
+ this.id = String.valueOf(id);
+ this.pid = String.valueOf(pid);
+ this.name = String.valueOf(name);
+ this.extra1 = String.valueOf(extra1);
+ }
+ }
+}
diff --git a/hutool-db/pom.xml b/hutool-db/pom.xml
index f4927311a..19a80bed4 100755
--- a/hutool-db/pom.xml
+++ b/hutool-db/pom.xml
@@ -94,6 +94,12 @@
org.apache.commons
commons-dbcp2
${dbcp2.version}
+
+
+ commons-pool2
+ org.apache.commons
+
+
true
@@ -108,10 +114,6 @@
jedis
${jedis.version}
-
- commons-pool2
- org.apache.commons
-
slf4j-api
org.slf4j
@@ -174,6 +176,12 @@
clickhouse-jdbc
0.3.2
test
+
+
+ gson
+ com.google.code.gson
+
+
diff --git a/hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java b/hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java
index 2236802cc..8145e745b 100644
--- a/hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java
+++ b/hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java
@@ -13,7 +13,7 @@ import java.io.Serializable;
/**
* Jedis数据源
- *
+ *
* @author looly
* @since 3.2.3
*/
@@ -30,7 +30,7 @@ public class RedisDS implements Closeable, Serializable {
// --------------------------------------------------------------------------------- Static method start
/**
* 创建RedisDS,使用默认配置文件,默认分组
- *
+ *
* @return RedisDS
*/
public static RedisDS create() {
@@ -39,7 +39,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 创建RedisDS,使用默认配置文件
- *
+ *
* @param group 配置文件中配置分组
* @return RedisDS
*/
@@ -49,7 +49,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 创建RedisDS
- *
+ *
* @param setting 配置文件
* @param group 配置文件中配置分组
* @return RedisDS
@@ -68,7 +68,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 构造,使用默认配置文件
- *
+ *
* @param group 配置文件中配置分组
*/
public RedisDS(String group) {
@@ -77,7 +77,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 构造
- *
+ *
* @param setting 配置文件
* @param group 配置文件中配置分组
*/
@@ -88,7 +88,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 初始化Jedis客户端
- *
+ *
* @param group Redis服务器信息分组
* @return this
*/
@@ -105,6 +105,13 @@ public class RedisDS implements Closeable, Serializable {
setting.toBean(group, config);
}
+ //issue#I54TZ9
+ final Long maxWaitMillis = setting.getLong("maxWaitMillis");
+ if(null != maxWaitMillis){
+ //noinspection deprecation
+ config.setMaxWaitMillis(maxWaitMillis);
+ }
+
this.pool = new JedisPool(config,
// 地址
setting.getStr("host", group, Protocol.DEFAULT_HOST),
@@ -130,7 +137,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 从资源池中获取{@link Jedis}
- *
+ *
* @return {@link Jedis}
*/
public Jedis getJedis() {
@@ -139,7 +146,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 从Redis中获取值
- *
+ *
* @param key 键
* @return 值
*/
@@ -151,7 +158,7 @@ public class RedisDS implements Closeable, Serializable {
/**
* 从Redis中获取值
- *
+ *
* @param key 键
* @param value 值
* @return 状态码
@@ -161,10 +168,10 @@ public class RedisDS implements Closeable, Serializable {
return jedis.set(key, value);
}
}
-
+
/**
* 从Redis中删除多个值
- *
+ *
* @param keys 需要删除值对应的键列表
* @return 删除个数,0表示无key可删除
*/