Lazy One-To-One Spring JPA and building “dynamic” JSON

后端 未结 3 1726
南笙
南笙 2020-12-11 16:19

I\'m developing a relatively large project using Spring Boot, and in a general way I\'m pretty happy with it, but I\'m having some problems that in my mind should\'t be a pr

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 16:58

    Regarding 'dynamic' JSON: Use DTOs.

    This has the advantage of tailoring the objects to be serialized to the exact needs of the client consuming the resulting JSON. Also, the domain model (Hibernate entities) is decoupled from the JSON (de)serialization logic, allowing the two to evolve independently.

提交回复
热议问题