title: Spring Interceptor not working in Spring Data REST URLs
body: <p>I am working on a project with Spring Data Rest and JPA and I am trying to configure an HTTP interceptor. As per the reference docs,
   available in <a href="https://docs.spring.io/spring/docs/5.0.2.BUILD-SNAPSHOT/spring-framework-reference/web.html#mvc-handlermapping-interceptor" rel="noreferrer">Spring Web MVC Docs - Handler Mapping Interceptor</a>, I created a component that extends HandlerInterceptorAdapter as follows:</p>
  
  <pre><code>@Component
  public class DBEditorTenantInterceptor extends HandlerInterceptorAdapter {
  
      Logger logger = LoggerFactory.getLogger(DBEditorTenantInterceptor.class);
  
      @Override
      public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
          throws Exception {
           logger.debug("********** INTERCEPTION SUCCESSFUL **********");
           return true;
      }
  }
  </code></pre>
  
  <p>And then, registered the interceptor by extending WebMvcConfig (as explained in <a href="https://docs.spring.io/spring/docs/5.0.2.BUILD-SNAPSHOT/spring-framework-reference/web.html#mvc-config-interceptors" rel="noreferrer">Spring Web MVC Docs - Config Interceptors</a></p>
  
  <pre><code>@Configuration
  public class WebMvcConfig extends WebMvcConfigurerAdapter {
  
      @Autowired
      DBEditorTenantInterceptor dbEditorTenantInterceptor;
  
      @Override
      public void addInterceptors(InterceptorRegistry registry) {
           registry.addInterceptor(dbEditorTenantInterceptor)
           .addPathPatterns("/**");
      }
  
  }
  </code></pre>
  
  <p>When I issue HTTP requests to any URL that is not used by Spring Data REST such as /helloworld the Interceptor works as expected, as I see the logger output</p>
  
  <pre><code>017-10-26 13:16:24.689 DEBUG 17012 --- [p-nio-80-exec-4] c.c.v.d.DBEditorTenantInterceptor        : ********** INTERCEPTION SUCCESSFUL **********
  </code></pre>
  
  <p>However, when the URL is used by spring data rest, my interceptor is not called. This applies to all URLs like /api/{existing entity in model}</p>
  
  <p>Why is my interceptor not called for Spring Data Rest URLs ? What can I do to make my interceptor work for all requests ? </p>
  
  <p>Thanks a lot in advance. </p>