diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index 8031cce4f4..e1196783ac 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -51,7 +51,7 @@
6.8.0
- 1.0.10
+ 1.4.0
1.18.3
1.18.36
1.6.3
@@ -564,9 +564,9 @@
- com.xingyuv
- spring-boot-starter-captcha-plus
- ${captcha-plus.version}
+ com.anji-plus
+ captcha-spring-boot-starter
+ ${anji-plus-captcha.version}
diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml
index 3126dedbfb..6ae9694b44 100644
--- a/yudao-module-system/yudao-module-system-biz/pom.xml
+++ b/yudao-module-system/yudao-module-system-biz/pom.xml
@@ -115,8 +115,8 @@
- com.xingyuv
- spring-boot-starter-captcha-plus
+ com.anji-plus
+ captcha-spring-boot-starter
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java
index f2c7141edf..92259da7cf 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java
@@ -2,20 +2,19 @@ package cn.iocoder.yudao.module.system.controller.admin.captcha;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
-import com.xingyuv.captcha.model.common.ResponseModel;
-import com.xingyuv.captcha.model.vo.CaptchaVO;
-import com.xingyuv.captcha.service.CaptchaService;
+import com.anji.captcha.model.common.ResponseModel;
+import com.anji.captcha.model.vo.CaptchaVO;
+import com.anji.captcha.service.CaptchaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.annotation.security.PermitAll;
+import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.annotation.Resource;
-import javax.annotation.security.PermitAll;
-import javax.servlet.http.HttpServletRequest;
-
@Tag(name = "管理后台 - 验证码")
@RestController("adminCaptchaController")
@RequestMapping("/system/captcha")
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java
index 23c8d78be2..5db497e430 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/config/YudaoCaptchaConfiguration.java
@@ -1,11 +1,14 @@
package cn.iocoder.yudao.module.system.framework.captcha.config;
import cn.iocoder.yudao.module.system.framework.captcha.core.RedisCaptchaServiceImpl;
-import com.xingyuv.captcha.properties.AjCaptchaProperties;
-import com.xingyuv.captcha.service.CaptchaCacheService;
-import com.xingyuv.captcha.service.impl.CaptchaServiceFactory;
+import com.anji.captcha.config.AjCaptchaAutoConfiguration;
+import com.anji.captcha.properties.AjCaptchaProperties;
+import com.anji.captcha.service.CaptchaCacheService;
+import com.anji.captcha.service.impl.CaptchaServiceFactory;
+import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
@@ -14,9 +17,11 @@ import org.springframework.data.redis.core.StringRedisTemplate;
* @author 芋道源码
*/
@Configuration(proxyBeanMethods = false)
+@ImportAutoConfiguration(AjCaptchaAutoConfiguration.class) // 目的:解决 aj-captcha 针对 SpringBoot 3.X 自动配置不生效的问题
public class YudaoCaptchaConfiguration {
- @Bean
+ @Bean(name = "AjCaptchaCacheService")
+ @Primary
public CaptchaCacheService captchaCacheService(AjCaptchaProperties config,
StringRedisTemplate stringRedisTemplate) {
CaptchaCacheService captchaCacheService = CaptchaServiceFactory.getCache(config.getCacheType().name());
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java
index d69b88ccfe..2e66a676b6 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java
@@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.system.framework.captcha.core;
-import com.xingyuv.captcha.service.CaptchaCacheService;
+import com.anji.captcha.service.CaptchaCacheService;
import lombok.Setter;
import org.springframework.data.redis.core.StringRedisTemplate;
@@ -28,7 +28,7 @@ public class RedisCaptchaServiceImpl implements CaptchaCacheService {
@Override
public boolean exists(String key) {
- return Boolean.TRUE.equals(stringRedisTemplate.hasKey(key));
+ return stringRedisTemplate.hasKey(key);
}
@Override
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
index 3fa0288c9b..94e589de5e 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
@@ -24,18 +24,18 @@ import cn.iocoder.yudao.module.system.service.member.MemberService;
import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
import cn.iocoder.yudao.module.system.service.social.SocialUserService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
+import com.anji.captcha.model.common.ResponseModel;
+import com.anji.captcha.model.vo.CaptchaVO;
+import com.anji.captcha.service.CaptchaService;
import com.google.common.annotations.VisibleForTesting;
-import com.xingyuv.captcha.model.common.ResponseModel;
-import com.xingyuv.captcha.model.vo.CaptchaVO;
-import com.xingyuv.captcha.service.CaptchaService;
+import jakarta.annotation.Resource;
+import jakarta.validation.Validator;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import javax.annotation.Resource;
-import javax.validation.Validator;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService b/yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService
similarity index 82%
rename from yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService
rename to yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService
index 946ee59649..fa9d5b2820 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService
+++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService
@@ -1 +1 @@
-cn.iocoder.yudao.module.system.framework.captcha.core.RedisCaptchaServiceImpl
+cn.iocoder.yudao.module.system.framework.captcha.core.RedisCaptchaServiceImpl
\ No newline at end of file
diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java
index e0865218d3..88b766fa8a 100644
--- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java
+++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java
@@ -19,17 +19,16 @@ import cn.iocoder.yudao.module.system.service.member.MemberService;
import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
import cn.iocoder.yudao.module.system.service.social.SocialUserService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
-import com.xingyuv.captcha.model.common.ResponseModel;
-import com.xingyuv.captcha.service.CaptchaService;
+import com.anji.captcha.model.common.ResponseModel;
+import com.anji.captcha.service.CaptchaService;
+import jakarta.annotation.Resource;
+import jakarta.validation.Validation;
+import jakarta.validation.Validator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
-import javax.annotation.Resource;
-import javax.validation.Validation;
-import javax.validation.Validator;
-
import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;