标签:tor 执行顺序 setfilter ann name one org att pattern
import org.springframework.boot.web.servlet.FilterRegistrationBean;import javax.servlet.Filter;
@Configuration
public class WebComponentConfig {
@Bean
public FilterRegistrationBean corsFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(CorsFilter());
registration.addUrlPatterns("/*");
registration.setName("corsFilter");
registration.setOrder(1);
return registration;
}
@Bean
public FilterRegistrationBean apiFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(ApiFilter());
registration.addUrlPatterns("/ides/api/*");
registration.setName("apiFilter");
registration.setOrder(2);
return registration;
}
@Bean
public Filter CorsFilter() {
return new CorsFilter();
}
@Bean
public Filter ApiFilter() {
return new ApiFilter();
}
}
CorsFilter类支持跨域过滤器 过滤路径/*
ApiFilter类接口认证过滤器 过滤路径自定义
多个过滤器执行顺序通过registration.setOrder(1);registration.setOrder(2); 语句设置
标签:tor 执行顺序 setfilter ann name one org att pattern
原文地址:http://blog.51cto.com/javaoraclelinux/2321084