From ecfe64c1883c226efea8fa4320d669106d7df4f3 Mon Sep 17 00:00:00 2001 From: MichaelWin Date: Mon, 22 Dec 2025 18:36:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=94=B9=E8=BF=9B=E3=80=91API?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/corewing/app/config/SaTokenConfig.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/corewing/app/config/SaTokenConfig.java b/src/main/java/com/corewing/app/config/SaTokenConfig.java index e27e7a5..92dd554 100644 --- a/src/main/java/com/corewing/app/config/SaTokenConfig.java +++ b/src/main/java/com/corewing/app/config/SaTokenConfig.java @@ -4,7 +4,9 @@ import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.stp.StpUtil; import com.corewing.app.common.page.PageInterceptor; import org.springframework.context.annotation.Configuration; +import org.springframework.util.ResourceUtils; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** @@ -40,8 +42,9 @@ public class SaTokenConfig implements WebMvcConfigurer { // .excludePathPatterns("/loading.html", "/admin/login.html") // 排除静态资源 .excludePathPatterns("/", "/*.css", "/*.js", "/*.ico", "/static/**", "/assets/**") - // 排除后台管理静态资源 -// .excludePathPatterns("/admin/**") + // 排除接口静态资源 + .excludePathPatterns("/doc.html", "/webjars/**") + .excludePathPatterns("/v3/api-docs/swagger-config", "/v3/api-docs/**", "/swagger-resources") // 排除 Druid 监控 .excludePathPatterns("/druid/**") // 排除错误页面 @@ -51,4 +54,10 @@ public class SaTokenConfig implements WebMvcConfigurer { // 排除咨询接口 .excludePathPatterns("/contactMsg", "/contactMsg/**"); } + + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("doc.html").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/META-INF/resources/"); + registry.addResourceHandler("/webjars/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/META-INF/resources/webjars/"); + } + }