To try to understand the spring ecosystem, I'm building some toy projects on varios parts.
I've got a spring-boot-data-rest service working as expected (code here) and I am building a spring-boot and spring-hateoas client to access it (code here)
BUT for some reason I don't understand the client doesn't see the links that the server has.
This is what the JSON the service serves looks like:
{
"firstName": "Alice",
"lastName": "Foo",
"_links": {
"self": {
"href": "http://localhost:8080/people/1"
},
"person": {
"href": "http://localhost:8080/people/1"
}
}
}
This is the code the client is using to query the service:
//now use a GET to get it back
ResponseEntity<Resource<Person>> getResult = rest.exchange(
"http://localhost:8080/people/1", HttpMethod.GET, null,
new ParameterizedTypeReference<Resource<Person>>() {
});
//check the links on the response
log.info("getResult "+getResult);
log.info("getResult.getBody"+getResult.getBody());
//uh oh, no links...
log.info("getResult.getLink(\"self\")"+getResult.getBody().getLink("self"));
log.info("getResult.getLink(\"self\").getHref()"+getResult.getBody().getLink("self").getHref());
And I am using Spring boot 1.4.0.BUILD-SNAPSHOT version for both.
Is this a problem with my code or is this a bug somewhere? Any ideas how to fix it?