From 61d1f70a8f516f5bfdd500961c24cd88c47c2433 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Tue, 1 Mar 2022 21:39:03 +0800 Subject: [PATCH] =?UTF-8?q?hippo-core=20enable=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BC=80=E5=85=B3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/starter/config/BootstrapCoreProperties.java | 11 ++++++++--- .../DynamicThreadPoolCoreAutoConfiguration.java | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/BootstrapCoreProperties.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/BootstrapCoreProperties.java index 9cceccb5..d09868ab 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/BootstrapCoreProperties.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/BootstrapCoreProperties.java @@ -22,20 +22,25 @@ public class BootstrapCoreProperties implements BootstrapPropertiesInterface { public static final String PREFIX = "spring.dynamic.thread-pool"; + /** + * Enable dynamic thread pool. + */ + private Boolean enable = Boolean.TRUE; + /** * Enabled banner. */ - private Boolean banner; + private Boolean banner = Boolean.TRUE; /*** * Enabled collect. */ - private Boolean collect; + private Boolean collect = Boolean.TRUE; /** * Check state interval. */ - private String checkStateInterval; + private Integer checkStateInterval; /** * Config file type. diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java index 448adbb6..26064af7 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/starter/config/DynamicThreadPoolCoreAutoConfiguration.java @@ -20,6 +20,7 @@ import lombok.AllArgsConstructor; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -36,6 +37,7 @@ import org.springframework.core.annotation.Order; @AllArgsConstructor @EnableConfigurationProperties(BootstrapCoreProperties.class) @ImportAutoConfiguration({UtilAutoConfiguration.class}) +@ConditionalOnProperty(prefix = BootstrapCoreProperties.PREFIX, value = "enable", matchIfMissing = true, havingValue = "true") public class DynamicThreadPoolCoreAutoConfiguration { private final BootstrapCoreProperties bootstrapCoreProperties;