I'm using spring hateoas to create a rest service. I have database entities which I'm exposing through the REST API. To simplify, let's say I have an entity that has three fields as follows.
id
- a unique identifierservice
- a service this item belongs tovalue
- a numeric attribute for this item
I am trying to implement the following URL schema:
@RequestMapping(value = "")
- return a collection of all items
@RequestMapping(value = "/{id}")
- return the specific item with this id
@RequestMapping(value = "/{service}")
- return a collection of all items with this service
The problem here is the 2nd and 3rd paths are ambiguous and Spring doesn't know which @RequestMapping
to match on if I try the URL below for example.
http://localhost/123
How can I deal with this?