diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolAdapterRegister.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolAdapterRegister.java index 8e10b255..42c66d23 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolAdapterRegister.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolAdapterRegister.java @@ -25,6 +25,7 @@ import org.springframework.beans.factory.InitializingBean; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import static cn.hippo4j.common.constant.Constants.IDENTIFY_SLICER_SYMBOL; @@ -55,10 +56,13 @@ public class DynamicThreadPoolAdapterRegister implements InitializingBean { } public void discoverAdapterExecutor() { - List adapterExecutors = bootstrapConfigProperties.getAdapterExecutors(); - for (AdapterExecutorProperties each : adapterExecutors) { - String buildKey = each.getMark() + IDENTIFY_SLICER_SYMBOL + each.getThreadPoolKey(); - ADAPTER_EXECUTORS_MAP.putIfAbsent(buildKey, each); - } + Optional> adapterExecutorProperties = + Optional.ofNullable(bootstrapConfigProperties.getAdapterExecutors()); + adapterExecutorProperties.ifPresent(props -> { + for (AdapterExecutorProperties each : props) { + String buildKey = each.getMark() + IDENTIFY_SLICER_SYMBOL + each.getThreadPoolKey(); + ADAPTER_EXECUTORS_MAP.putIfAbsent(buildKey, each); + } + }); } }