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.
答案 0 :(得分:0)
你可以使用regexp使spring认为两个映射是不同的。请参阅the documentation。
@RequestMapping("/users/{userId:\\d+}/addresses")