spring boot 拦截器添加

Posted until—u

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring boot 拦截器添加相关的知识,希望对你有一定的参考价值。

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
  @Override
  public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new YourInterceptor()).addPathPatterns("/xx/**")//要拦截的请求
.excludePathPatterns(
"/xxx/*");//不拦截的请求
} }

以上是关于spring boot 拦截器添加的主要内容,如果未能解决你的问题,请参考以下文章