refactor: 调整公共配置装配位置.

pull/161/head
chen.ma 3 years ago
parent aa19960582
commit 0d36621af4

@ -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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /**
* * .
* *
* @author chen.ma * @author chen.ma
* @date 2021/6/20 18:52 * @date 2021/7/19 21:03
*/ */
@Configuration @Configuration
public class CommonConfiguration { public class CommonConfig {
@Bean @Bean
public ApplicationContextHolder simpleApplicationContextHolder() { public ApplicationContextHolder simpleApplicationContextHolder() {

@ -1,13 +1,10 @@
package io.dynamic.threadpool.starter.config; package io.dynamic.threadpool.starter.config;
import io.dynamic.threadpool.common.config.CommonConfiguration; import io.dynamic.threadpool.common.config.ApplicationContextHolder;
import io.dynamic.threadpool.starter.core.ThreadPoolConfigAdapter;
import io.dynamic.threadpool.starter.controller.PoolRunStateController; import io.dynamic.threadpool.starter.controller.PoolRunStateController;
import io.dynamic.threadpool.starter.core.ConfigService; import io.dynamic.threadpool.starter.core.*;
import io.dynamic.threadpool.starter.core.ThreadPoolConfigService;
import io.dynamic.threadpool.starter.enable.DynamicThreadPoolMarkerConfiguration; import io.dynamic.threadpool.starter.enable.DynamicThreadPoolMarkerConfiguration;
import io.dynamic.threadpool.starter.listener.ThreadPoolRunListener; import io.dynamic.threadpool.starter.handler.ThreadPoolBannerHandler;
import io.dynamic.threadpool.starter.core.ThreadPoolOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@ -27,11 +24,21 @@ import org.springframework.context.annotation.Configuration;
@AllArgsConstructor @AllArgsConstructor
@EnableConfigurationProperties(DynamicThreadPoolProperties.class) @EnableConfigurationProperties(DynamicThreadPoolProperties.class)
@ConditionalOnBean(DynamicThreadPoolMarkerConfiguration.Marker.class) @ConditionalOnBean(DynamicThreadPoolMarkerConfiguration.Marker.class)
@ImportAutoConfiguration({OkHttpClientConfig.class, CommonConfiguration.class}) @ImportAutoConfiguration(OkHttpClientConfig.class)
public class DynamicThreadPoolAutoConfiguration { public class DynamicThreadPoolAutoConfiguration {
private final DynamicThreadPoolProperties properties; private final DynamicThreadPoolProperties properties;
@Bean
public ThreadPoolBannerHandler threadPoolBannerHandler() {
return new ThreadPoolBannerHandler(properties);
}
@Bean
public ApplicationContextHolder simpleApplicationContextHolder() {
return new ApplicationContextHolder();
}
@Bean @Bean
public ConfigService configService() { public ConfigService configService() {
return new ThreadPoolConfigService(properties); return new ThreadPoolConfigService(properties);
@ -56,5 +63,4 @@ public class DynamicThreadPoolAutoConfiguration {
public PoolRunStateController poolRunStateController() { public PoolRunStateController poolRunStateController() {
return new PoolRunStateController(); return new PoolRunStateController();
} }
} }

Loading…
Cancel
Save