title: REST controllers with same Path
body: <p>I'm using Spring frame work with jersey to implement REST.
  I have a 2 sets of paths in the following patterns</p>
  
  <p>Set 1:</p>
  
  <pre><code>/top/{top_id}/&lt;some string&gt;
  ex:
  
  /top/{top_id}/book
  
  /top/{top_id}/pen
  
  /top/{top_id}/dog
  </code></pre>
  
  <p>Set 2 :</p>
  
  <pre><code>/top/{top_id}/middle/{middle_id}/&lt;some string&gt;
  ex:
  
  /top/{top_id}/middle/{middle_id}/book
  
  /top/{top_id}/middle/{middle_id}/pen
  
  /top/{top_id}/middle/{middle_id}/dog
  </code></pre>
  
  <p>Since these work on different levels ( set 1 on top level and set 2 on middle level) , I want to create different controllers classes for them.</p>
  
  <pre><code>    @Component
      public class Top{
      }
  
      @Component
      public class Middle{
      }
  </code></pre>
  
  <p>The problem I'm having is both sets have /top/{top_id} common. </p>
  
  <p>I don't know what to use as the value for @Path annotation written above the class. I tried removing it, but Jersey is not recognizing the class. Please suggest a method to implement this. I'm trying to do this because there are around 100 paths in each layer. I don't want to keep them all together in a single file. Thank you.</p>