The json output of the links differ quite a bit from the single entity object. If I use the implementation in this example. I get the json output like this:
{
"content":"Hello, User!",
"_links":{
"self":{
"href":"http://localhost:8080/greeting?name=User"
}
}
}
@RequestMapping("/greeting/{name}" )
public HttpEntity<List<Greeting>> greeting(@PathVariable(value = "name") String name) {
Greeting greeting = new Greeting(String.format(TEMPLATE, name));
greeting.add(linkTo(methodOn(AuditHistoryController.class).greeting(name)).withSelfRel());
List<Greeting> greetings = new ArrayList<>();
greetings.add(greeting);
return new ResponseEntity<>(greetings, HttpStatus.OK);
}
The output json is quite different. Refer the change in links
[
{
"content": "Hello, User!",
"links": [
{
"rel": "self",
"href": "http://localhost:8899/risk-portal/api/greeting/User",
"hreflang": null,
"media": null,
"title": null,
"type": null,
"deprecation": null
}
]
}
]