I'm using Spring Data REST to build my application. It's been working very well so far, but I'd like to add some customizations to returned entity while still keeping the automatically generated links.
I'd like to do something like this:
@RepositoryRestController
public class SomeController {
@GetMapping("/entity/{id}")
public SomeEntity getEntity(@PathVariable int id)
SomeEntity entity = SpringDataREST.findById(id); //-> is there a way to do this?
Link randomLink = generateRandomLink();
entity.addLink(randomLink);
//do other stuff with entity
return entity;
}
}
Where SomeEntity
class extends Spring HATEOAS ResourceSupport
.