/**
*
* 自定义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/")
;
}
}