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