title: Ambiguous mapping found with ControllerClassNameHandlerMapping
body: <p>How to map requests to methods without explicit annotations on top of methods? For instance, the following request:</p>
  
  <pre><code>http://somedomain:8080/SampleSpring/access/loginFailed
  </code></pre>
  
  <p>should be mapped to </p>
  
  <p>"loginFailed" method of "AccessController" without the need of explicit annotation on method like:</p>
  
  <pre><code>@RequestMapping("/access/loginFailed")
  </code></pre>
  
  <p>Here is my spring configuration:</p>
  
  <pre><code>&lt;context:component-scan base-package="com.robikcodes.samplespring"/&gt;
  &lt;mvc:annotation-driven/&gt;
  
  &lt;bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"&gt;
          &lt;property name="basePackage" value="com.robikcodes.samplespring.controller"/&gt;
          &lt;property name="caseSensitive" value="true"/&gt;
          &lt;property name="defaultHandler"&gt;
              &lt;bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/&gt;
          &lt;/property&gt;
  &lt;/bean&gt;   
  
  &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
              &lt;property name="prefix" value="/WEB-INF/views/"/&gt;
              &lt;property name="suffix" value=".jsp"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Here is my controller:</p>
  
  <pre><code>@Controller
  public class AccessController{
  
      @RequestMapping(method = RequestMethod.GET)
      public void login(ModelMap m) {}
  
      @RequestMapping(method = RequestMethod.GET)
      public String loginFailed(ModelMap m) {
          m.addAttribute("error", "true");
          return "access/login";
      }
  
      @RequestMapping(method = RequestMethod.GET)
      public String logout(ModelMap m) {
          m.addAttribute("logoutStatus","true");
          return "access/login";
      }
  }
  </code></pre>
  
  <p>I got the following error (seems like only login method was mapped properly):</p>
  
  <pre><code>org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'accessController' bean method 
  public java.lang.String com.robikcodes.samplespring.controller.AccessController.logout(org.springframework.ui.ModelMap)
  to {[],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'accessController' bean method
  public void com.robikcodes.samplespring.controller.AccessController.login(org.springframework.ui.ModelMap) mapped.
  </code></pre>