-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@JsonIgnore has no effect when using Lombok @Getter #1226
Comments
Unfortunately I would need a test that does not make use of Lombok; perhaps generated class, if possible. Your usage looks correct and I would expect |
Here is the class after the Lombok code generation:
|
I've experienced the same issue with 2.7.3. Employing @cowtowncoder is that an expected change in behavior? |
@sivasankariit An easy solution would be to set |
Ah ok, was missing the produced class. So, seeing the definition I do understand why things work the way they do. So: what happens with respect to
Now... due to having both ignoral and inclusion (due to explicit creator), handling considers it a "split" case. As such, getter is "pulled in" and considered visible. One way to prevent this would be to move (or just add) Alternatively, there is the question of whether Third way is to prevent Lombok from adding the annotation itself. This may or may not make sense, depending on what intent is. So at this point I have to say that yes, this is the expected behavior as of 2.7 and beyond. |
@cowtowncoder, it totally makes sense now. Thank you for elaboration! |
Please take a look to combination |
@ollifer used |
When using the
@Getter
lombok annotation on a class along with@JsonIgnore
on class fields, the@JsonIgnore
has no effect during serialization. This is a change in behavior when upgrading from jackson-databind v2.6.4 to v.2.7.4. I've added a sample test case below with the serialized outputs in each case.The text was updated successfully, but these errors were encountered: