Spring MVC - Interceptor never called

后端 未结 6 1973
我寻月下人不归
我寻月下人不归 2021-02-15 15:06

I am trying to configure an interceptor in my application and I am not being able to make it work.

In my application configuration class, I have configured in the follow

6条回答
  •  梦谈多话
    2021-02-15 15:44

    This approach worked with me

    
    @Configuration
    public class WebConfiguration extends WebMvcConfigurerAdapter {
      @Override
      public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor());
      }
    }
    
    

提交回复
热议问题