How to disable wrapping collections with dependencies (in my case Set) in the links in the response body? explanation below.
There are entities with @OneToMany and @ManyToOne connections. There is a repository inherited from JpaRepository. The application is on SpringBut, everything works on a spring date. That is, the controllers and services are implemented by spring itself. For clarity, below classes Owner and Cat
@Entity public class Cat{ @Id Long Id; String catName; @ManyToOne(...) Owner owner; Class hosts
@Entity public class Owner{ @Id Long Id; String ownerName; @OneToMany(...) Set<Cat> pets; Everything works, classes are created, the cats are drawn into the set. In JSON format, the output looks like this:
{"id":"1", "catName":"Barsik", "owner":"Valera"} and the owner
{"id":"1", "ownerName":"Valera", "pets":[{"id":"1", "catName":"Barsik", "owner":"Valera"}]} BUT (!) Spring Data provides data in the HAL + JSON format, and the host output looks like this
{"id":"1", "ownerName":"Valera", "_links" : { "self" : { "href" : "http://localhost:8080/owners/1" }, "lot" : { "href" : "http://localhost:8080/owners/1" }, "pets" : { "href" : "http://localhost:8080/owners/1/pets"} }} I am very grateful to the spring for the care, and the fact that he built the rest for me, but I need to work with the model when the cat is invested in the owner in one JSONe.
QUESTION: How to disable wrapping collections with dependencies (in my case Set) into links in the response body?