Please find my HomeController and DemoController
class HomeController{
@RequestMapping(value=\"index\")
public void home(){
}
}
class DemoController{
@Reque
https://stackoverflow.com/a/34590355/2682499 is only partially correct at this point.
You can have multiple controller methods use the same URI so long as you provide Spring enough additional information on which one it should use. Whether or not you should do this is a different question. I would certainly not recommend using the same URI in two separate controller classes to avoid confusion, though.
You can do something like this:
class HomeController{
@RequestMapping(value="/index", params = {"!name", "!foo"})
public List listItems(){
// retrieve Something list
}
@RequestMapping(value="/index", params = "name")
public List listItems(String name) {
// retrieve Something list WHERE name LIKE %name%
}
@RequestMapping(value="/index", params = {"!name", "foo"})
public List listItems(String foo) {
// Do something completely different
}
}
For the full documentation on what is possible when overloading URIs you should reference the @ReqeustMapping documentation: https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html. And, specifically https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html#params-- for the section request parameters.