I was creating the backend for Angular Tour of Heroes App and I ran into this problem. Don't you think that spring-boot should recognize them differently due to the number and/or type of their parameters? I think this can be enhanced in future releases.
Comment From: nahidshahin
No, form url point of view, GET:/heroes and GET:/heroes?id=123 is same because url param is not mandatory.
Comment From: bclozel
This is by design - the @*Mapping annotation needs to described what the requests should look like to be mapped there. Checking the actual method signature is only done as a second step when invoking the handler.
@GetMapping(params = "id") should solve the problem here. For further questions, please use StackOverflow.