mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
refactor(captcha/behavior): 移除部分无用注解
This commit is contained in:
@@ -60,7 +60,7 @@ public class BehaviorCaptchaAutoConfiguration {
|
||||
* 自定义缓存实现配置
|
||||
*/
|
||||
@Configuration
|
||||
@Import({BehaviorCaptchaCacheConfiguration.Redis.class,BehaviorCaptchaCacheConfiguration.Custom.class})
|
||||
@Import({BehaviorCaptchaCacheConfiguration.Redis.class, BehaviorCaptchaCacheConfiguration.Custom.class})
|
||||
protected static class BehaviorCaptchaCacheAutoConfiguration {
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package top.charles7c.continew.starter.captcha.behavior.autoconfigure;
|
||||
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.anji.captcha.service.CaptchaCacheService;
|
||||
import com.anji.captcha.service.impl.CaptchaServiceFactory;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.AccessLevel;
|
||||
@@ -26,7 +25,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.client.RedisClient;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import top.charles7c.continew.starter.cache.redisson.autoconfigure.RedissonAutoConfiguration;
|
||||
import top.charles7c.continew.starter.captcha.behavior.enums.StorageType;
|
||||
@@ -46,14 +44,13 @@ abstract class BehaviorCaptchaCacheConfiguration {
|
||||
* 自定义缓存实现类-Redis
|
||||
*/
|
||||
@ConditionalOnClass(RedisClient.class)
|
||||
@ConditionalOnMissingBean(CaptchaCacheService.class)
|
||||
@AutoConfigureBefore(RedissonAutoConfiguration.class)
|
||||
@ConditionalOnProperty(name = "continew-starter.captcha.behavior.cache-type", havingValue = "redis")
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
static class Redis {
|
||||
|
||||
@PostConstruct
|
||||
public void captchaCacheService() {
|
||||
public void postConstruct() {
|
||||
CaptchaServiceFactory.cacheService.put(StorageType.REDIS.name().toLowerCase(), new BehaviorCaptchaCacheServiceImpl());
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Redis' completed initialization.");
|
||||
}
|
||||
@@ -62,13 +59,12 @@ abstract class BehaviorCaptchaCacheConfiguration {
|
||||
/**
|
||||
* 自定义缓存实现类-自定义
|
||||
*/
|
||||
@ConditionalOnMissingBean(CaptchaCacheService.class)
|
||||
@ConditionalOnProperty(name = "continew-starter.captcha.behavior.cache-type", havingValue = "custom")
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
static class Custom {
|
||||
|
||||
@PostConstruct
|
||||
public void captchaCacheService(BehaviorCaptchaProperties properties) {
|
||||
public void postConstruct(BehaviorCaptchaProperties properties) {
|
||||
CaptchaServiceFactory.cacheService.put(StorageType.CUSTOM.name().toLowerCase(), ReflectUtil.newInstance(properties.getCacheImpl()));
|
||||
log.debug("[ContiNew Starter] - Auto Configuration 'Behavior-CaptchaCache-Custom' completed initialization.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user