diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index 46020dc58..dad575867 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -43,7 +43,7 @@
6.8.0
- 1.0.2
+ 1.0.4
1.15.4
1.18.26
1.5.5.Final
@@ -67,7 +67,7 @@
8.5.2
4.6.3
2.2.1
- 3.1.715
+ 3.1.758
1.4.0
1.5.6
2.12.2
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java
index 2a690d800..32d2b4b87 100644
--- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java
@@ -3,11 +3,15 @@ package cn.iocoder.yudao.framework.captcha.config;
import cn.hutool.core.util.ClassUtil;
import cn.iocoder.yudao.framework.captcha.core.enums.CaptchaRedisKeyConstants;
import cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl;
+import com.xingyuv.captcha.properties.AjCaptchaProperties;
import com.xingyuv.captcha.service.CaptchaCacheService;
+import com.xingyuv.captcha.service.impl.CaptchaServiceFactory;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.StringRedisTemplate;
+import javax.annotation.Resource;
+
@AutoConfiguration
public class YudaoCaptchaConfiguration {
@@ -17,9 +21,17 @@ public class YudaoCaptchaConfiguration {
ClassUtil.loadClass(CaptchaRedisKeyConstants.class.getName());
}
+ @Resource
+ private StringRedisTemplate stringRedisTemplate;
+
@Bean
- public CaptchaCacheService captchaCacheService(StringRedisTemplate stringRedisTemplate) {
- return new RedisCaptchaServiceImpl(stringRedisTemplate);
+ public CaptchaCacheService captchaCacheService(AjCaptchaProperties config) {
+ //缓存类型redis/local/....
+ CaptchaCacheService ret = CaptchaServiceFactory.getCache(config.getCacheType().name());
+ if(ret instanceof RedisCaptchaServiceImpl){
+ ((RedisCaptchaServiceImpl)ret).setStringRedisTemplate(stringRedisTemplate);
+ }
+ return ret;
}
}
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java
index 1429c47c2..95c9ec4af 100644
--- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java
@@ -25,6 +25,10 @@ public class RedisCaptchaServiceImpl implements CaptchaCacheService {
return "redis";
}
+ public void setStringRedisTemplate(StringRedisTemplate stringRedisTemplate) {
+ this.stringRedisTemplate = stringRedisTemplate;
+ }
+
@Override
public void set(String key, String value, long expiresInSeconds) {
stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS);