Handling ambiguous handler methods mapped in REST application with Spring
<p>I tried to use some code as below: </p>

<pre class="lang-java prettyprint-override"><code>@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public Brand getBrand(@PathVariable Integer id) {
    return brandService.getOne(id);
}

@RequestMapping(value = "/{name}", method = RequestMethod.GET)
public List&lt;Brand&gt; getBrand(@PathVariable String name) {
    return brandService.getSome(name);
}
</code></pre>

<p>But I got error like this, how can I do?</p>

<pre class="lang-none prettyprint-override"><code>java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path 'http://localhost:8080/api/brand/1': {public java.util.List com.zangland.controller.BrandController.getBrand(java.lang.String), public com.zangland.entity.Brand com.zangland.controller.BrandController.getBrand(java.lang.Integer)}
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:375) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
</code></pre>