@Configuration
public class InterceptorConfig implements WebMvcConfigurer{
@Override
public void addInterceptors(InterceptorRegistry registry) {
// TODO Auto-generated method stub
registry.addInterceptor(new LoginInterceptor())
.addPathPatterns("/user/reg").excludePathPatterns("/", "/user/logins", "/login.html");
}
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// TODO Auto-generated method stub
//排除静态资源拦截
registry.addResourceHandler("/static/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX+"/static/");
WebMvcConfigurer.super.addResourceHandlers(registry);
}
}
springboot2.0自定义拦截器之后放行静态资源
最新推荐文章于 2022-10-06 21:03:01 发布