From f39761d4b514fe820ff7ea50ac74c3c96b761c65 Mon Sep 17 00:00:00 2001 From: itao Date: Thu, 1 Feb 2024 01:00:21 +0800 Subject: [PATCH] feat: jwt interceptor exclude swagger path --- .../src/main/java/com/luoo/tag/config/WebMvcConfig.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/luoo_tag/src/main/java/com/luoo/tag/config/WebMvcConfig.java b/luoo_tag/src/main/java/com/luoo/tag/config/WebMvcConfig.java index dbfe048..7f340f5 100644 --- a/luoo_tag/src/main/java/com/luoo/tag/config/WebMvcConfig.java +++ b/luoo_tag/src/main/java/com/luoo/tag/config/WebMvcConfig.java @@ -17,8 +17,10 @@ public class WebMvcConfig extends WebMvcConfigurationSupport { * @param registry */ protected void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(jwtInterceptor). - addPathPatterns("/**"); + String[] excludePaths = {"/doc.html/**","/swagger-resources/**","/webjars/**","/v2/**"}; + registry.addInterceptor(jwtInterceptor) + .excludePathPatterns(excludePaths) + .addPathPatterns("/**"); } @Override protected void addResourceHandlers(ResourceHandlerRegistry registry) {