mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 07:01:37 +08:00
refactor: 使用常量优化部分配置属性名
This commit is contained in:
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -50,7 +51,7 @@ import java.util.Properties;
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnProperty(prefix = "continew-starter.captcha.behavior", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = PropertiesConstants.CAPTCHA_BEHAVIOR, name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
@EnableConfigurationProperties(BehaviorCaptchaProperties.class)
|
||||
public class BehaviorCaptchaAutoConfiguration {
|
||||
|
||||
|
@@ -33,6 +33,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import top.charles7c.continew.starter.cache.redisson.autoconfigure.RedissonAutoConfiguration;
|
||||
import top.charles7c.continew.starter.captcha.behavior.enums.StorageType;
|
||||
import top.charles7c.continew.starter.captcha.behavior.impl.BehaviorCaptchaCacheServiceImpl;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
/**
|
||||
* 行为验证码缓存配置
|
||||
@@ -49,7 +50,7 @@ abstract class BehaviorCaptchaCacheConfiguration {
|
||||
*/
|
||||
@ConditionalOnClass(RedisClient.class)
|
||||
@AutoConfigureBefore(RedissonAutoConfiguration.class)
|
||||
@ConditionalOnProperty(name = "continew-starter.captcha.behavior.cache-type", havingValue = "redis")
|
||||
@ConditionalOnProperty(name = PropertiesConstants.CAPTCHA_BEHAVIOR + ".cache-type", havingValue = "redis")
|
||||
static class Redis {
|
||||
static {
|
||||
CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name().toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
|
||||
@@ -60,7 +61,7 @@ abstract class BehaviorCaptchaCacheConfiguration {
|
||||
/**
|
||||
* 自定义缓存实现类-自定义
|
||||
*/
|
||||
@ConditionalOnProperty(name = "continew-starter.captcha.behavior.cache-type", havingValue = "custom")
|
||||
@ConditionalOnProperty(name = PropertiesConstants.CAPTCHA_BEHAVIOR + ".cache-type", havingValue = "custom")
|
||||
static class Custom {
|
||||
|
||||
@Bean
|
||||
|
@@ -21,6 +21,7 @@ import com.anji.captcha.service.CaptchaCacheService;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import top.charles7c.continew.starter.captcha.behavior.enums.StorageType;
|
||||
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -31,7 +32,7 @@ import java.awt.*;
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "continew-starter.captcha.behavior")
|
||||
@ConfigurationProperties(PropertiesConstants.CAPTCHA_BEHAVIOR)
|
||||
public class BehaviorCaptchaProperties {
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user