Can I make a custom controller mirror the formatting of Spring-Data-Rest / Spring-Hateoas generated classes?

I’ve found a way to imitate the behavior of Spring Data Rest completely. The trick lies in using a combination of the PagedResourcesAssembler and an argument-injected instance of PersistentEntityResourceAssembler. Simply define your controller as follows… @RepositoryRestController @RequestMapping(“…”) public class ThingController { @Autowired private PagedResourcesAssembler pagedResourcesAssembler; @SuppressWarnings(“unchecked”) // optional – ignores warning on return statement below… … Read more

Enable HAL serialization in Spring Boot for custom controller method

There’s a lot of aspects here: I doubt that the collection resource at /transactions really returns an individual transaction as you described. Those representations are returned for item resources. If TransactionRepository already is a PageableAndSortingRepository the collection resource can be tweaked by expanding the URI template exposed in the API root for the link named … Read more