diff --git a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java index d08112f5..aa59ef58 100644 --- a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java +++ b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java @@ -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 { } diff --git a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java index 9ed1e49b..02e70e43 100644 --- a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java +++ b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaCacheConfiguration.java @@ -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."); }