spring boot 拦截器添加
@Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired private XxxInterceptor xxxInterceptor;//需要在该拦截器上添加@Configuration注解才能注入
@Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new YourInterceptor()).addPathPatterns("/xx/**")//要拦截的请求
.excludePathPatterns("/xxx/*");//不拦截的请求
registry.addInterceptor(xxxInterceptor).addPathPatterns("xxx/xx")//推荐
} }