diff --git a/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java b/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java index 4f7316da..83a38f49 100644 --- a/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java +++ b/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java @@ -108,4 +108,11 @@ public interface BootstrapPropertiesInterface { return null; } + /** + * Get consul. + */ + default Map getConsul() { + return null; + } + } diff --git a/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java b/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java index 1bc87dc0..859a2f4e 100644 --- a/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java +++ b/kernel/dynamic/mode/config/src/main/java/cn/hippo4j/threadpool/dynamic/mode/config/properties/BootstrapConfigProperties.java @@ -81,6 +81,11 @@ public class BootstrapConfigProperties implements BootstrapPropertiesInterface { */ private Map polaris; + /** + * consul config + */ + private Map consul; + /** * Web config * diff --git a/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java b/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java index d20573f6..4696f37e 100644 --- a/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java +++ b/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java @@ -178,6 +178,16 @@ public class BeforeCheckConfiguration { "Please check whether the [spring.dynamic.thread-pool.polaris.file.type] configuration is empty or an empty string."); } } + + Map consul = properties.getConsul(); + if (MapUtil.isNotEmpty(consul)) { + String dataKey = consul.get("data-key"); + if (StringUtil.isBlank(dataKey)) { + throw new ConfigEmptyException( + "Web server maybe fail to start. The dynamic thread pool consul data-key is empty.", + "Please check whether the [spring.dynamic.thread-pool.consul.data-key] configuration is empty or an empty string."); + } + } break; } default: