同事!
我们希望将Rest Client写入遵循HATEOAS原则的服务.所以我们有以下HAL + JSON表示,我们想使用spring-hateoas反序列化它:
{
"id": "1",
"title": "album title",
"artistId": "1",
"stockLevel": 2,
"_links": {
"self": {"href": "http://localhost:8080/rest/albums/1"},
"artist": {"href": "http://localhost:8080/rest/artist/1"}
},
"_embedded": {
"albums": [{ //can be array or object
"id": "1",
"title": "album title",
"artistId": "1",
"stockLevel": 2,
"_links": {
"self": {"href": "http://localhost:8080/rest/albums/1"}
}
}],
"artist": { //can be array or object
"id": "1",
"name": "artist name",
"_links": {
"self": {"href": "http://localhost:8080/rest/artist/1"}
}
} //....
}
}
Run Code Online (Sandbox Code Playgroud)
我们期望这样的java对象:
HalResource {
Resource<Album> //entity
List<Link> // _links
List<Resource<BaseEntity>>{ …Run Code Online (Sandbox Code Playgroud)