title: How to split Spring MVC request mapping by parameter value
body: <p>In Spring MVC 3 I want to handle the same url with two different controller classes - depending on value of url parameter. <strong>@RequestMapping</strong> annotation even has such field: <strong>params</strong>, and I thought following would be two different mappings (I use mapping on class level):</p>
  
  <pre><code>@RequestMapping(value = "/myurl", params = "name=val1")
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@RequestMapping(value = "/myurl", params = "name=val2")
  </code></pre>
  
  <p>but it's not. Spring throws exception for second case that controller for <strong>/myurl</strong> already mapped (by first case).</p>
  
  <p>Is there some accurate solution for splitting request mapping by parameter? May be extending @RequestMapping or using proxy as controller and call different controllers depending on parameter...
  Any thoughts?</p>
  
  <p><strong>UPDATE</strong>
  This works but only on methods level, not on class level...
  This will:</p>
  
  <pre><code>@Controller
  @RequestMapping(value = "/myurl")
  public class Class123 {
  
      @RequestMapping(value = {"edit.htm"}, params = "src=1")
      public String open1(Map&lt;String, Object&gt; map) throws Exception {....}
  
      @RequestMapping(value = {"edit.htm"}, params = "src=2")
      public String open2(Map&lt;String, Object&gt; map) throws Exception {....}
  }
  </code></pre>
  
  <p>this won't:</p>
  
  <pre><code>@Controller
  @RequestMapping(value = "/myurl", params = "src=1")
  public class Class123_1 {
  
      @RequestMapping(value = {"edit.htm"})
      public String open(Map&lt;String, Object&gt; map) throws Exception {....}
  }
  
  
  @Controller
  @RequestMapping(value = "/myurl", params = "src=2")
  public class Class123_2 {
  
      @RequestMapping(value = {"edit.htm"})
      public String open(Map&lt;String, Object&gt; map) throws Exception {....}
  }
  </code></pre>
  
  <p>And I would like to split logic in different classes.</p>