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/"); + } + }