New file |
| | |
| | | package com.example.erp.config; |
| | | |
| | | import com.example.erp.common.interceptor.JwtInterceptor; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Configuration |
| | | |
| | | public class InterceptorConfig implements WebMvcConfigurer { |
| | | @Resource |
| | | private JwtInterceptor jwtInterceptor; |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | registry.addInterceptor(jwtInterceptor) |
| | | .addPathPatterns("/**") |
| | | .excludePathPatterns("/user/login", |
| | | "/user/register", |
| | | "/swagger-resources/**" |
| | | ,"/webjars/**" |
| | | ,"/v2/**" |
| | | ,"/swagger-ui.html/**" |
| | | ,"/swagger-ui.html#/**"); |
| | | } |
| | | |
| | | |
| | | } |