Reputation: 1822
I am a bit confused and need help in understanding the way I can define my REST URI for users.
Requirement: I wanted to achieve something like below:
To achieve this I exposed two methods one with URI '/users/me/addresses' and other with '/users/{userId}/addresses'. However seems Spring consider both of the API as same and doesn't allow that. So I am looking for an alternative approach to achieve my goal.
Upvotes: 1
Views: 180
Reputation: 691765
You can use a regexp to make spring consider the two mappings as different. See the documentation.
@RequestMapping("/users/{userId:\\d+}/addresses")
Upvotes: 1