美文网首页
2019-06-03 springboot 配置拦截器

2019-06-03 springboot 配置拦截器

作者: zz云飞扬 | 来源:发表于2019-06-03 15:07 被阅读0次

/**

*

* 自定义Spring mvc配置

*

*/

@Configuration

public class WebMvcConfig

extends WebMvcConfigurerAdapter {

@Bean

    public RuseridInterceptor getRuseridInterceptor() {

return new RuseridInterceptor();

}

/**

* 定义拦截器

    * @param registry

    */

    @Override

    public void addInterceptors(InterceptorRegistry registry) {

registry.addInterceptor(getRuseridInterceptor())

.addPathPatterns("/aaa/public","/bbb/public","/ccc/public")

//  .excludePathPatterns("/static/**","/error/**")

      ;

}

@Override

    public void addResourceHandlers(ResourceHandlerRegistry registry) {

registry.addResourceHandler("/static/**")

.addResourceLocations("classpath:/META-INF/resources/")

.addResourceLocations("classpath:/resources/")

.addResourceLocations("classpath:/static/")

.addResourceLocations("classpath:/public/")

;

}

}

相关文章

网友评论

      本文标题:2019-06-03 springboot 配置拦截器

      本文链接:https://www.haomeiwen.com/subject/gtmcxctx.html