Actually, this was due to the Resource class, which is built to transfer the contents of your bean. The content property is annotated by @JsonUnwrapped , so the Resource class can display your bean in this property, while in json the bean properties are at the same level as the _links property. Using this annotation, it is possible that the property name conflicts with the wrapper and internal bean. This is just because the Resource class has an id property inherited from the ResourceSupport class, and this property is sadly annotated by @JsonIgnore .
There is a workaround for this problem. You can create a new MixIn class, inherited from the ResourceSupportMixin class, and override the getId() method with the @JsonIgnore(false) annotation:
public abstract class IdResourceSupportMixin extends ResourceSupportMixin { @Override @JsonIgnore(false) public abstract Link getId(); }
Then you just need to add your IdResourceSupportMixin class to your ObjectMapper :
mapper.addMixInAnnotations(ResourceSupport.class, IdResourceSupportMixin.class);
He must solve the problem.
source share