Spring boot spirng引导如何在自定义spring引导启动中添加拦截器
如何在third spring boot start use autoConfiguration中添加Spring boot spirng引导如何在自定义spring引导启动中添加拦截器,spring-boot,spring-mvc,Spring Boot,Spring Mvc,如何在third spring boot start use autoConfiguration中添加拦截器如FilterRegistrationBean? 或者使用拦截器还有其他技巧吗?您必须使用WebMVCConfigureAdapter向拦截器注册此拦截器,如下所示− @Component public class ApplicationInterceptorConfig extends WebMvcConfigurerAdapter { @Autowired LoggerIn
拦截器
如FilterRegistrationBean
?
或者使用拦截器还有其他技巧吗?您必须使用WebMVCConfigureAdapter向拦截器注册此拦截器,如下所示−
@Component
public class ApplicationInterceptorConfig extends WebMvcConfigurerAdapter {
@Autowired
LoggerInterceptor loggerInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loggerInterceptor);
}
}