Rest 如何为模型之间的多个关系显示Hateoas_链接?
我目前有一个REST+HATEOAS+HAL API,它使用Rest 如何为模型之间的多个关系显示Hateoas_链接?,rest,spring-boot,relationship,hateoas,hal,Rest,Spring Boot,Relationship,Hateoas,Hal,我目前有一个REST+HATEOAS+HAL API,它使用\u links供客户端导航API 我有一些模型 #User Long id String username @Many to Many List<Trip> trips etc. #Trip Long id String title etc. @Many to Many List<User> users @OneToMany List&
\u links
供客户端导航API
我有一些模型
#User
Long id
String username
@Many to Many
List<Trip> trips
etc.
#Trip
Long id
String title
etc.
@Many to Many
List<User> users
@OneToMany
List<Place> places
#Place
Long id
String title
@Many to One
Trip trip
@OneToOne <---- user doesn't know about relationship
User user
@OneToMany
List<Vote> votes
#Vote
Long id
boolean vote
@Many to One
Place place
@OneToOne <---- user doesn't know about relationship
User user
但是有一个单独的地方
url是:api/users/1/trips/1/places/3
进行个人投票:api/users/1/trips/1/places/3/vows/2
或者使用url,您是否开始越深入地简化
单个地点的示例:trips/1/places/3
投票方式为:places/3/投票/2
我看了很多例子,但大多数情况下都停留在两个实体之间的单一关系上
{
...userInfo
"_links": [{
"self":{
"href": "api/users/1",
"method": "GET"
}
"trips": [{
"href": api/users/1/trips.
"method": "GET"
},
{
"href": "api/users/1/trips",
"method": "POST"
}]
}