Describe the bug Any annotation to ignore property is not working with a particular variable name is used.

Version information 2.11.2 (Spring Boot 2.1.3.RELEASE)

To Reproduce Below does not work, tried with @JsonIgnore @JsonIgnoreProperty @JsonBackReference. The value gets serialized in json always, no matter whatever annotation is used.

@JsonBackReference
private ClassName dLogHeader;

But if the variable name is changed then it starts working and does not serialize it.

@JsonBackReference
private ClassName logHeader;

Comment From: cowtowncoder

I can not reproduce this without test case, but I suspect that your problem is with mismatch between property name and matching getter/setter method: there is no getter/setter that could result in implied name like dLogHeader. If so, you may need to add another @JsonIgnore.

I am not sure why you are using @JsonBackReference here -- it is only to be used coupled with @JsonManagedReference.

Comment From: xlm13x

I am using Lombok so getter/setter are being generated using @Data annotation.

Regarding the @JsonBackReference, this is being used with JPA relationship so yes it is coupled with @JsonManagedReference. I event tried @JsonIgnore but that is not working as well.

Comment From: cowtowncoder

Ok. As I said I would need an actual test case -- and one where Lombok definitions are resolved (i.e. test can not depend on Lombok processing). But I would suggest first looking for Lombok documentation to see if there is a way to force addition of @JsonIgnore also on getter for this property. I think it is likely that use of this particular naming convention is the problem here as the getter name Lombok generated is probably not the one that would match.

Comment From: cowtowncoder

Closing as there is no reproduction: may be reopened with one.

Comment From: cowtowncoder

Collecting similar cases to address, re-opening.

Comment From: cowtowncoder

Will be resolved via #5152, closing again.