@Bean public FilterRegistrationBean resourceFilterRegistration() { FilterRegistrationBean bean = new FilterRegistrationBean(); bean.setFilter(resourceFilter); bean.setEnabled(false); return bean; }
/** 扩展filter */ @Bean public FilterRegistrationBean filterRegistrationBean(AuthFilter filter) { FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); filterRegistrationBean.setFilter(filter); filterRegistrationBean.setEnabled(true); filterRegistrationBean.addUrlPatterns("/admin"); return filterRegistrationBean; }
@Bean @DependsOn("tokenAuthFilter") public FilterRegistrationBean tokenAuthFilterRegisterBean() { FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); filterRegistrationBean.setFilter(tokenAuthFilter()); filterRegistrationBean.setEnabled(false); filterRegistrationBean.setDispatcherTypes(EnumSet.allOf(DispatcherType.class)); return filterRegistrationBean; }