diff --git a/README.md b/README.md index 3fd2ce2d0..f0abaa954 100644 --- a/README.md +++ b/README.md @@ -79,12 +79,12 @@ Hutool目前主要版本4.x、5.x、6.x、7.x,选择如下: -| 版本 | jdk | Maven仓库 | 主要特点 | -|-----|--------|-----------------------------------------------------------------------------------------------------|-------------------------------------| -| 4.x | jdk1.7 | [cn.hutool/hutool-all/4.x](https://mvnrepository.com/artifact/cn.hutool/hutool-all/4.6.17) | jdk1.7编译 | -| 5.x | jdk1.8 | [cn.hutool/hutool-all/5.x ](https://mvnrepository.com/artifact/cn.hutool/hutool-all) | jdk1.8编译,使用JavaEE,适配JDK11、17、21 | +| 版本 | jdk | Maven仓库 | 主要特点 | +|-----|--------|--------------------------------------------------------------------------------------------------------|-------------------------------------| +| 4.x | jdk1.7 | [cn.hutool/hutool-all/4.x](https://mvnrepository.com/artifact/cn.hutool/hutool-all/4.6.17) | jdk1.7编译 | +| 5.x | jdk1.8 | [cn.hutool/hutool-all/5.x ](https://mvnrepository.com/artifact/cn.hutool/hutool-all) | jdk1.8编译,使用JavaEE,适配JDK11、17、21 | | 6.x | jdk1.8 | [org.dromara.hutool/hutool-all/6.x ](https://mvnrepository.com/artifact/org.dromara.hutool/hutool-all) | jdk1.8编译,使用Jakarta EE,适配JDK11、17、21 | -| 7.x | jdk17 | [cn.hutool/hutool-all/6.x ](https://mvnrepository.com/artifact/org.dromara.hutool/hutool-all) | jdk17编译,使用Jakarta EE,适配17+ | +| 7.x | jdk17 | [cn.hutool.v7/hutool-all/6.x ](https://mvnrepository.com/artifact/org.dromara.hutool/hutool-all) | jdk17编译,使用Jakarta EE,适配17+ | ## 🛠️包含组件 diff --git a/hutool-setting/src/main/java/cn/hutool/v7/setting/Setting.java b/hutool-setting/src/main/java/cn/hutool/v7/setting/Setting.java index 534710145..e6d0f5663 100644 --- a/hutool-setting/src/main/java/cn/hutool/v7/setting/Setting.java +++ b/hutool-setting/src/main/java/cn/hutool/v7/setting/Setting.java @@ -26,6 +26,7 @@ import cn.hutool.v7.core.io.resource.Resource; import cn.hutool.v7.core.io.resource.ResourceUtil; import cn.hutool.v7.core.io.watch.WatchMonitor; import cn.hutool.v7.core.io.watch.WatchUtil; +import cn.hutool.v7.core.io.watch.watchers.DelayWatcher; import cn.hutool.v7.core.io.watch.watchers.SimpleWatcher; import cn.hutool.v7.core.lang.Assert; import cn.hutool.v7.core.text.CharUtil; @@ -35,6 +36,7 @@ import cn.hutool.v7.log.LogUtil; import cn.hutool.v7.setting.props.Props; import java.io.File; +import java.io.Serial; import java.net.URL; import java.nio.charset.Charset; import java.nio.file.WatchEvent; @@ -56,6 +58,7 @@ import java.util.function.Consumer; * @author Looly */ public class Setting extends AbsSetting implements Map { + @Serial private static final long serialVersionUID = 3618305164959883393L; /** @@ -199,7 +202,8 @@ public class Setting extends AbsSetting implements Map { Assert.notNull(this.resource, "Setting resource must be not null !"); // 先关闭之前的监听 IoUtil.closeQuietly(this.watchMonitor); - this.watchMonitor = WatchUtil.ofModify(resource.getUrl(), new SimpleWatcher() { + this.watchMonitor = WatchUtil.ofModify(resource.getUrl(), new DelayWatcher(new SimpleWatcher() { + @Serial private static final long serialVersionUID = 5190107321461226190L; @Override @@ -210,7 +214,7 @@ public class Setting extends AbsSetting implements Map { callback.accept(Setting.this); } } - }); + }, 600)); this.watchMonitor.start(); LogUtil.debug("Auto load for [{}] listenning...", this.resource.getUrl()); }