Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot spirng引导如何在自定义spring引导启动中添加拦截器_Spring Boot_Spring Mvc - Fatal编程技术网

Spring boot spirng引导如何在自定义spring引导启动中添加拦截器

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

如何在third spring boot start use autoConfiguration中添加
拦截器
FilterRegistrationBean

或者使用拦截器还有其他技巧吗?您必须使用WebMVCConfigureAdapter向拦截器注册此拦截器,如下所示−

@Component
public class ApplicationInterceptorConfig extends WebMvcConfigurerAdapter {
   @Autowired
   LoggerInterceptor loggerInterceptor;

   @Override
   public void addInterceptors(InterceptorRegistry registry) {
      registry.addInterceptor(loggerInterceptor);
   }
}