spring-projects / spring-data-rest

Simplifies building hypermedia-driven REST web services on top of Spring Data repositories
https://spring.io/projects/spring-data-rest
Apache License 2.0
914 stars 560 forks source link

Entity Id (and version) is serialized from rest controller after upgrade to spring boot 2.3.3 [DATAREST-1558] #1920

Open spring-projects-issues opened 4 years ago

spring-projects-issues commented 4 years ago

arongas opened DATAREST-1558 and commented

 

I was using Spring boot springBootVersion = '2.1.9.RELEASE' and need at a project to migrate to springBootVersion = '2.3.3.RELEASE'. In this project we use spring data rest and also have some controllers returning database entities as EntityModel/Resource.

Before the upgrade what is serialized from the controller (and returned as as Resource) does not contain the entity id or the entity version. Similar to spring data rest interface. 

After upgrade, spring data rest interface continues to not return the id or the version, which is correct/expected but in the controller, the EntityModel\ is serialized/returned along with the id/version json properties. I could not find the reason or any reference of it in trhe documentation. Is this a bug or is intended? Can this becaviour somehow be adapted vis project configuration to remain as it was with spring boot 2.1.9.RELEASE?

 

I have create a sample/small project with 2 unit tests. 

In commit Sample project with Spling boot 2.1.9,  the id and version in both controller and spring data rest are not exposed and both unit test com.example.demo.DemoApplicationTests#payloads and com.example.demo.DemoApplicationTests#dataRestPayloads pass.

In commit Spring boot 2.3.3, the unit test com.example.demo.DemoApplicationTests#payloads fails because id appears in the json body of the response.

 

If this is not the correct place for tracking this issue, please guide me accordingly.

 


Affects: 3.3.3 (Neumann SR3)

Reference URL: https://github.com/arongas/payload

spring-projects-issues commented 4 years ago

arongas commented

I see no possitive or negative interaction with this bug. Did i not open it correct or it simply has low priority?