Reputation: 13240
Consider this Spring MVC Controller:
@Controller
@RequestMapping("/test*")
public class TestController {
@RequestMapping(method = RequestMethod.GET)
public void doStuff(Model model){
...
}
@RequestMapping(params = "myParam")
public void doStuff(@RequestParam("myParam") int myParam, Model model){
...
}
}
When I put this into my browser:
mySite.com/test.html?myParam=1
I expected an AmbiguousHandlerMappingException or something, since both methods seem to match the URL.
But actually the first method got called. Does anybody know why?
Upvotes: 7
Views: 2648
Reputation: 403441
This smells like a bug. If you add method=GET to the second handler, it works as expected, so that's the workaround.
I've filed a bug report on this, hopefully it'll be addressed.
http://jira.springframework.org/browse/SPR-5772
Upvotes: 5