标签:tail 过滤 class auto color style autowire autowired ref
需求:在SpringBoot实现拦截器,并且需要自定义的filter类型自动装配一些对象
自定义的过滤器类
public class SessionExpireFilter implements Filter{ @Autowired private StringRedisTemplate redisTemplate; }
重点是变量自动配置类
@Configuration public class MyFilter { @Bean public FilterRegistrationBean sessionExpireFilter(){ FilterRegistrationBean registrationBean = new FilterRegistrationBean(); registrationBean.setFilter(this.SessionExpireFilter()); registrationBean.addUrlPatterns("/*"); return registrationBean; } @Bean public Filter SessionExpireFilter() { return new SessionExpireFilter(); } }
原文:https://blog.csdn.net/ycd500756/article/details/81676456
标签:tail 过滤 class auto color style autowire autowired ref
原文地址:https://www.cnblogs.com/feecy/p/10271885.html