From 56fbc2ed8f610d33033403593fc761807c12bebe Mon Sep 17 00:00:00 2001 From: MuShan Date: Tue, 13 May 2025 22:48:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A7=20shiro=20=E5=88=B0?= =?UTF-8?q?=202.0.4=20=E7=89=88=E6=9C=AC=EF=BC=8C=E8=A7=A3=E5=86=B3Shiro?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=20requestMappingHandlerMapping=20=E6=97=B6?= =?UTF-8?q?=20spring-boot-autoconfigure:3.4.5=20=E5=92=8C=20spring-boot-ac?= =?UTF-8?q?tuator-autoconfigure:3.4.5=20Bean=20=E4=BE=9D=E8=B5=96=E5=86=B2?= =?UTF-8?q?=E7=AA=81=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecg-boot/jeecg-boot-base-core/pom.xml | 1 + .../util/encryption/AesEncryptUtil.java | 2 +- .../org/jeecg/config/shiro/ShiroConfig.java | 25 +++++++++++++------ jeecg-boot/pom.xml | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/jeecg-boot/jeecg-boot-base-core/pom.xml b/jeecg-boot/jeecg-boot-base-core/pom.xml index e86532475..17ead3b53 100644 --- a/jeecg-boot/jeecg-boot-base-core/pom.xml +++ b/jeecg-boot/jeecg-boot-base-core/pom.xml @@ -204,6 +204,7 @@ org.apache.shiro shiro-spring-boot-starter + jakarta ${shiro.version} diff --git a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java index 670f3ebd6..6a4db4215 100644 --- a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java +++ b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java @@ -1,6 +1,6 @@ package org.jeecg.common.util.encryption; -import org.apache.shiro.codec.Base64; +import org.apache.shiro.lang.codec.Base64; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; diff --git a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index 877662fce..e46ce9bc7 100644 --- a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -1,5 +1,8 @@ package org.jeecg.config.shiro; +import jakarta.annotation.Resource; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.Filter; import lombok.extern.slf4j.Slf4j; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; @@ -17,25 +20,20 @@ import org.jeecg.config.shiro.filters.CustomShiroFilterFactoryBean; import org.jeecg.config.shiro.filters.JwtFilter; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.*; -import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.env.Environment; -import org.springframework.core.type.filter.AnnotationTypeFilter; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.*; import org.springframework.web.filter.DelegatingFilterProxy; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import redis.clients.jedis.HostAndPort; import redis.clients.jedis.JedisCluster; -import jakarta.annotation.Resource; -import jakarta.servlet.Filter; -import jakarta.servlet.DispatcherType; -import java.lang.reflect.Method; import java.util.*; /** @@ -350,6 +348,17 @@ public class ShiroConfig { return manager; } + /** + * 解决 ShiroRequestMappingConfig 获取 requestMappingHandlerMapping Bean 冲突 + * spring-boot-autoconfigure:3.4.5 和 spring-boot-actuator-autoconfigure:3.4.5 + */ + @Primary + @Bean + public RequestMappingHandlerMapping shiroRequestMappingHandlerMapping( + @Qualifier("requestMappingHandlerMapping") RequestMappingHandlerMapping handlerMapping) { + return handlerMapping; + } + private List rebuildUrl(String[] bases, String[] uris) { List urls = new ArrayList<>(); for (String base : bases) { diff --git a/jeecg-boot/pom.xml b/jeecg-boot/pom.xml index 9f8512f29..fba760f04 100644 --- a/jeecg-boot/pom.xml +++ b/jeecg-boot/pom.xml @@ -67,7 +67,7 @@ 2.1.0 3.17.3 - 1.13.0 + 2.0.4 3.2.3 3.11.0 1.4.9