title: Allow Spring to have multiple WebMvcConfigurer implementations in different jars
body: <p>When using Spring Web, in this case for rest endpoints &amp; using Spring Boot 2, I can configure interceptors for my app using by implementing the <code>WebMvcConfigurer</code> interface:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class SpringWebConfig implements WebMvcConfigurer
  {
      @Override
      public void addInterceptors(InterceptorRegistry registry) {
          registry.addInterceptor(new MyInterceptor).addPathPatterns("/api/endpoint/**");
      }
  }
  </code></pre>
  
  <p>I added this interceptor to most of my apps in an automatic fashion by doing the following:</p>
  
  <ol>
  <li>Create a "common-jar", and put the above interface under package<br>
  <code>com.company.api</code>. </li>
  <li>In every app, add the package <code>com.company.api</code> to
  the api scan.</li>
  </ol>
  
  <p>This common package also contains the Interceptor and utility classes to make this interceptor work, so in effect, adding this common-jar would automatically add he interceptor to all operations in the app, which is a similar concept as to what Spring itself does: adding dependencies changes the default configuration of Spring.</p>
  
  <p>The problem I'm facing now is this approach cannot be extended to a second interceptor in a second jar, because I already used the <code>WebMvcConfigurer</code> implementation. and I cannot have two. </p>
  
  <p>I was thinking about maybe using some kind of composite-configurer pattern where we loop over every configurer, collect all interceptors, and then add them once, but unfortunately Spring doesn't allow this. What are my options? </p>
  
  <p>Currently, the approach I took is duplicating the <code>WebMvcConfigurer</code> interface in every app that requires it. I feel sad when something changes, and I have to change the same snippet of code in every single app.</p>