While using Spring Data Rest after migrating an app to Spring Boot, I have observed that entity properties with @Id are no longer marshalled to JSON

前端 未结 5 1697
逝去的感伤
逝去的感伤 2020-11-28 12:03

This question is related to this SO question (Spring boot @ResponseBody doesn't serialize entity id). I have observed that after migrating an app to Spring Boot and usi

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 12:32

    Before expose Id please read disussion: https://github.com/spring-projects/spring-hateoas/issues/66

    In REST the id of a resource is its URI. The client doesn't explicitly use the id to build an url. You could, for example, replace your id for an uuid, for example. Or even change the url scheme.

提交回复
热议问题