chore: 完善 ConditionalOnProperty 配置

This commit is contained in:
2024-09-11 21:22:19 +08:00
parent 5d1601e6eb
commit 0cede6bf9f
12 changed files with 13 additions and 13 deletions

View File

@@ -35,7 +35,7 @@ import top.continew.starter.core.constant.PropertiesConstants;
* @since 1.0.0 * @since 1.0.0
*/ */
@AutoConfiguration(before = com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration.class) @AutoConfiguration(before = com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration.class)
@ConditionalOnProperty(prefix = "justauth", name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = "justauth", name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class JustAuthAutoConfiguration { public class JustAuthAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(JustAuthAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(JustAuthAutoConfiguration.class);

View File

@@ -46,7 +46,7 @@ import java.util.List;
* @since 1.0.0 * @since 1.0.0
*/ */
@AutoConfiguration @AutoConfiguration
@ConditionalOnProperty(prefix = "spring.data.redisson", name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.data.redisson", name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
@EnableConfigurationProperties(RedissonProperties.class) @EnableConfigurationProperties(RedissonProperties.class)
public class RedissonAutoConfiguration { public class RedissonAutoConfiguration {

View File

@@ -49,7 +49,7 @@ import java.util.Properties;
*/ */
@AutoConfiguration @AutoConfiguration
@EnableConfigurationProperties(BehaviorCaptchaProperties.class) @EnableConfigurationProperties(BehaviorCaptchaProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.CAPTCHA_BEHAVIOR, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.CAPTCHA_BEHAVIOR, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class BehaviorCaptchaAutoConfiguration { public class BehaviorCaptchaAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(BehaviorCaptchaAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(BehaviorCaptchaAutoConfiguration.class);

View File

@@ -35,7 +35,7 @@ import top.continew.starter.core.constant.PropertiesConstants;
*/ */
@AutoConfiguration @AutoConfiguration
@EnableConfigurationProperties(GraphicCaptchaProperties.class) @EnableConfigurationProperties(GraphicCaptchaProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.CAPTCHA_GRAPHIC, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.CAPTCHA_GRAPHIC, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class GraphicCaptchaAutoConfiguration { public class GraphicCaptchaAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(GraphicCaptchaAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(GraphicCaptchaAutoConfiguration.class);

View File

@@ -42,7 +42,7 @@ import java.util.concurrent.Executor;
@Lazy @Lazy
@AutoConfiguration @AutoConfiguration
@EnableAsync(proxyTargetClass = true) @EnableAsync(proxyTargetClass = true)
@ConditionalOnProperty(prefix = "spring.task.execution.extension", name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.task.execution.extension", name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class AsyncAutoConfiguration implements AsyncConfigurer { public class AsyncAutoConfiguration implements AsyncConfigurer {
private static final Logger log = LoggerFactory.getLogger(AsyncAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(AsyncAutoConfiguration.class);

View File

@@ -52,7 +52,7 @@ public class ThreadPoolAutoConfiguration {
* 异步任务线程池配置 * 异步任务线程池配置
*/ */
@Bean @Bean
@ConditionalOnProperty(prefix = "spring.task.execution.extension", name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.task.execution.extension", name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public ThreadPoolTaskExecutorCustomizer threadPoolTaskExecutorCustomizer(ThreadPoolExtensionProperties properties) { public ThreadPoolTaskExecutorCustomizer threadPoolTaskExecutorCustomizer(ThreadPoolExtensionProperties properties) {
return executor -> { return executor -> {
// 核心(最小)线程数 // 核心(最小)线程数
@@ -71,7 +71,7 @@ public class ThreadPoolAutoConfiguration {
* 定时任务线程池配置 * 定时任务线程池配置
*/ */
@EnableScheduling @EnableScheduling
@ConditionalOnProperty(prefix = "spring.task.scheduling.extension", name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.task.scheduling.extension", name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public static class TaskSchedulerConfiguration { public static class TaskSchedulerConfiguration {
@Bean @Bean
public ThreadPoolTaskSchedulerCustomizer threadPoolTaskSchedulerCustomizer(ThreadPoolExtensionProperties properties) { public ThreadPoolTaskSchedulerCustomizer threadPoolTaskSchedulerCustomizer(ThreadPoolExtensionProperties properties) {

View File

@@ -30,6 +30,6 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD}) @Target({ElementType.TYPE, ElementType.METHOD})
@Documented @Documented
@ConditionalOnProperty(prefix = PropertiesConstants.LOG, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.LOG, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public @interface ConditionalOnEnabledLog { public @interface ConditionalOnEnabledLog {
} }

View File

@@ -46,7 +46,7 @@ import top.continew.starter.messaging.websocket.dao.WebSocketSessionDaoDefaultIm
@AutoConfiguration @AutoConfiguration
@EnableWebSocket @EnableWebSocket
@EnableConfigurationProperties(WebSocketProperties.class) @EnableConfigurationProperties(WebSocketProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.MESSAGING_WEBSOCKET, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.MESSAGING_WEBSOCKET, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class WebSocketAutoConfiguration { public class WebSocketAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(WebSocketAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(WebSocketAutoConfiguration.class);

View File

@@ -36,7 +36,7 @@ import top.continew.starter.security.crypto.core.MyBatisEncryptInterceptor;
*/ */
@AutoConfiguration @AutoConfiguration
@EnableConfigurationProperties(CryptoProperties.class) @EnableConfigurationProperties(CryptoProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_CRYPTO, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_CRYPTO, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class CryptoAutoConfiguration { public class CryptoAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(CryptoAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(CryptoAutoConfiguration.class);

View File

@@ -39,7 +39,7 @@ import top.continew.starter.security.limiter.core.RateLimiterNameGenerator;
@AutoConfiguration @AutoConfiguration
@EnableConfigurationProperties(RateLimiterProperties.class) @EnableConfigurationProperties(RateLimiterProperties.class)
@ComponentScan({"top.continew.starter.security.limiter.core"}) @ComponentScan({"top.continew.starter.security.limiter.core"})
@ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_LIMITER, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_LIMITER, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class RateLimiterAutoConfiguration { public class RateLimiterAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(RateLimiterAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(RateLimiterAutoConfiguration.class);

View File

@@ -53,7 +53,7 @@ import java.util.Map;
*/ */
@AutoConfiguration @AutoConfiguration
@EnableConfigurationProperties(PasswordEncoderProperties.class) @EnableConfigurationProperties(PasswordEncoderProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_PASSWORD, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.SECURITY_PASSWORD, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class PasswordEncoderAutoConfiguration { public class PasswordEncoderAutoConfiguration {
private static final Logger log = LoggerFactory.getLogger(PasswordEncoderAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(PasswordEncoderAutoConfiguration.class);

View File

@@ -40,7 +40,7 @@ import java.util.Map;
@EnableWebMvc @EnableWebMvc
@AutoConfiguration @AutoConfiguration
@EnableConfigurationProperties(LocalStorageProperties.class) @EnableConfigurationProperties(LocalStorageProperties.class)
@ConditionalOnProperty(prefix = PropertiesConstants.STORAGE_LOCAL, name = PropertiesConstants.ENABLED, matchIfMissing = true) @ConditionalOnProperty(prefix = PropertiesConstants.STORAGE_LOCAL, name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
public class LocalStorageAutoConfiguration implements WebMvcConfigurer { public class LocalStorageAutoConfiguration implements WebMvcConfigurer {
private static final Logger log = LoggerFactory.getLogger(LocalStorageAutoConfiguration.class); private static final Logger log = LoggerFactory.getLogger(LocalStorageAutoConfiguration.class);