Procházet zdrojové kódy

feat:【framework 框架】@PermitAll、@TenantIgnore 支持接口级

YunaiV před 9 měsíci
rodič
revize
efb2092261

+ 2 - 1
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java

@@ -137,7 +137,8 @@ public class YudaoTenantAutoConfiguration {
         // 获得有 @TenantIgnore 注解的接口
         for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : handlerMethodMap.entrySet()) {
             HandlerMethod handlerMethod = entry.getValue();
-            if (!handlerMethod.hasMethodAnnotation(TenantIgnore.class)) {
+            if (!handlerMethod.hasMethodAnnotation(TenantIgnore.class) // 方法级
+                && !handlerMethod.getBeanType().isAnnotationPresent(TenantIgnore.class)) { // 接口级
                 continue;
             }
             // 添加到忽略的 URL 中

+ 2 - 1
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java

@@ -165,7 +165,8 @@ public class YudaoWebSecurityConfigurerAdapter {
         // 获得有 @PermitAll 注解的接口
         for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : handlerMethodMap.entrySet()) {
             HandlerMethod handlerMethod = entry.getValue();
-            if (!handlerMethod.hasMethodAnnotation(PermitAll.class)) {
+            if (!handlerMethod.hasMethodAnnotation(PermitAll.class) // 方法级
+                && !handlerMethod.getBeanType().isAnnotationPresent(PermitAll.class)) { // 接口级
                 continue;
             }
             Set<String> urls = new HashSet<>();