mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 20:57:23 +08:00
refactor: Configuration => AutoConfiguration
This commit is contained in:
@@ -17,12 +17,12 @@
|
||||
package top.charles7c.continew.starter.core.autoconfigure.cors;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
@@ -37,7 +37,7 @@ import top.charles7c.continew.starter.core.constant.StringConsts;
|
||||
*/
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnProperty(prefix = "cors", name = "enabled", havingValue = "true")
|
||||
@EnableConfigurationProperties(CorsProperties.class)
|
||||
|
@@ -19,8 +19,8 @@ package top.charles7c.continew.starter.core.autoconfigure.threadpool;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
@@ -39,7 +39,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
*/
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(prefix = "thread-pool", name = "enabled", havingValue = "true")
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
public class AsyncAutoConfiguration implements AsyncConfigurer {
|
||||
|
@@ -19,11 +19,11 @@ package top.charles7c.continew.starter.core.autoconfigure.threadpool;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
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;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import top.charles7c.continew.starter.core.util.ExceptionUtils;
|
||||
@@ -41,7 +41,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
*/
|
||||
@Slf4j
|
||||
@Lazy
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(prefix = "thread-pool", name = "enabled", havingValue = "true")
|
||||
@EnableConfigurationProperties(ThreadPoolProperties.class)
|
||||
public class ThreadPoolAutoConfiguration {
|
||||
|
Reference in New Issue
Block a user