diff --git a/common/src/main/java/io/dynamic/threadpool/common/config/CommonConfiguration.java b/config/src/main/java/io/dynamic/threadpool/config/config/CommonConfig.java similarity index 61% rename from common/src/main/java/io/dynamic/threadpool/common/config/CommonConfiguration.java rename to config/src/main/java/io/dynamic/threadpool/config/config/CommonConfig.java index 41e8e9db..b85f6d85 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/config/CommonConfiguration.java +++ b/config/src/main/java/io/dynamic/threadpool/config/config/CommonConfig.java @@ -1,16 +1,17 @@ -package io.dynamic.threadpool.common.config; +package io.dynamic.threadpool.config.config; +import io.dynamic.threadpool.common.config.ApplicationContextHolder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** - * 公共配置 + * 公共配置. * * @author chen.ma - * @date 2021/6/20 18:52 + * @date 2021/7/19 21:03 */ @Configuration -public class CommonConfiguration { +public class CommonConfig { @Bean public ApplicationContextHolder simpleApplicationContextHolder() { diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java index 013d569c..61932f3a 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java @@ -1,13 +1,10 @@ package io.dynamic.threadpool.starter.config; -import io.dynamic.threadpool.common.config.CommonConfiguration; -import io.dynamic.threadpool.starter.core.ThreadPoolConfigAdapter; +import io.dynamic.threadpool.common.config.ApplicationContextHolder; import io.dynamic.threadpool.starter.controller.PoolRunStateController; -import io.dynamic.threadpool.starter.core.ConfigService; -import io.dynamic.threadpool.starter.core.ThreadPoolConfigService; +import io.dynamic.threadpool.starter.core.*; import io.dynamic.threadpool.starter.enable.DynamicThreadPoolMarkerConfiguration; -import io.dynamic.threadpool.starter.listener.ThreadPoolRunListener; -import io.dynamic.threadpool.starter.core.ThreadPoolOperation; +import io.dynamic.threadpool.starter.handler.ThreadPoolBannerHandler; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; @@ -27,11 +24,21 @@ import org.springframework.context.annotation.Configuration; @AllArgsConstructor @EnableConfigurationProperties(DynamicThreadPoolProperties.class) @ConditionalOnBean(DynamicThreadPoolMarkerConfiguration.Marker.class) -@ImportAutoConfiguration({OkHttpClientConfig.class, CommonConfiguration.class}) +@ImportAutoConfiguration(OkHttpClientConfig.class) public class DynamicThreadPoolAutoConfiguration { private final DynamicThreadPoolProperties properties; + @Bean + public ThreadPoolBannerHandler threadPoolBannerHandler() { + return new ThreadPoolBannerHandler(properties); + } + + @Bean + public ApplicationContextHolder simpleApplicationContextHolder() { + return new ApplicationContextHolder(); + } + @Bean public ConfigService configService() { return new ThreadPoolConfigService(properties); @@ -56,5 +63,4 @@ public class DynamicThreadPoolAutoConfiguration { public PoolRunStateController poolRunStateController() { return new PoolRunStateController(); } - }