How to expose the resourceId with Spring Data Rest

后端 未结 2 1795
一生所求
一生所求 2020-12-03 15:08

I had was to expose the primary key which is annotated with @Id in entity.the ID field is only visible on the resource path, but not on the JSON body.

2条回答
  •  青春惊慌失措
    2020-12-03 15:37

    The best solution would be not to using the IDs of your entities, and use the link references the hypermedia provides. You just need to parse your JSON accordingly to the HAL specification used by Spring Data Rest.

提交回复
热议问题