title: Use different paths for public and private resources Jersey + Spring boot
body: <p>I'm using Spring boot + Jersey + Spring security, I want to have public and private endpoints, I want an schema as follow:</p>
  
  <ul>
  <li><strong>/rest</strong> -- My root context </li>
  <li><strong>/public</strong> -- I want to place my public endpoints in this context, It must be inside of the root context like <code>/rest/public/pings</code></li>
  <li><strong>/private</strong> -- I want to place my private endpoints in this context, It must be inside of the root context like <code>/rest/private/accounts</code></li>
  </ul>
  
  <p>I have my configuration as follow:</p>
  
  <p><strong>Jersey</strong> configuration:</p>
  
  <pre><code>@Configuration
  @ApplicationPath("/rest")
  public class RestConfig extends ResourceConfig {
      public RestConfig() {
          register(SampleResource.class);
      }
  }
  </code></pre>
  
  <p><strong>Spring security</strong> configuration:</p>
  
  <pre><code>@Configuration
  public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
  
  ........
  
      protected void configure(HttpSecurity http) throws Exception {
          http.authorizeRequests().antMatchers("/rest/public/**").permitAll();
          http.antMatcher("/rest/**").authorizeRequests().anyRequest().fullyAuthenticated().and().httpBasic();
          http.csrf().disable();
      }
  
  }
  </code></pre>
  
  <p>The question is how can I register two application paths inside of my /rest context, one for /public and the other one for /private ?</p>
  
  <p>NOTE: I tried to create another ResourceConfig as follow:</p>
  
  <pre><code>@Configuration
  @ApplicationPath("/rest/public")
  public class RestPublicConfig extends ResourceConfig{
      public RestPublicConfig() {
          register(PingResource.class);
      }
  }
  </code></pre>
  
  <p>But I'm getting the next error:</p>
  
  <pre><code> No qualifying bean of type [org.glassfish.jersey.server.ResourceConfig] is defined: expected single matching bean but found 2: restConfig,restPublicConfig
  </code></pre>
  
  <p>Thanks for your help :)</p>