2019-01-27 Springboot
作者:
vpike | 来源:发表于
2019-01-27 11:40 被阅读0次
拦截器
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurationSupport{
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 多个拦截器组成一个拦截器链
// addPathPatterns 用于添加拦截规则
// excludePathPatterns 用户排除拦截
registry.addInterceptor(new SessionInterceptor()).addPathPatterns("/ipran/**").excludePathPatterns(Arrays.asList("/ipran/static/**","/ipran/ssointer/**","/ipran/iom/**","/ipran/test/**"));
super.addInterceptors(registry);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//将所有/static/** 访问都映射到classpath:/static/ 目录下
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
}
本文标题:2019-01-27 Springboot
本文链接:https://www.haomeiwen.com/subject/ocugjqtx.html
网友评论