需求:在SpringBoot实现拦截器,并且需要自定义的filter类型自动装配一些对象 自定义的过滤器类 public class SessionExpireFilter implements Filter{ @Autowired private StringRedisTemplate redisTemplate; } 重点是变量自动配置类 @Configuration public class MyFilter { @Bean public FilterRegistrationBean se…
Spring boot is really good for Dependencies injection by using Autowiring. Each class instancse in spring boot is called 'Bean', we can use 'Bean' to help us to simplfy the task. Fro example we have main class: @SpringBootApplication public class In2…