-
-
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
Inconsistent serialization with @JsonUnwrapped
annotation using shared vs. new ObjectMapper
instances
#4697
Comments
Right, seems like sort of caching is affecting this behavior. As an immediate solution, how about serializing all instances in intended order as warm-up? Also, try to look for pre-existing issue. I think I saw similar Github issue |
Yes, this definitely looks like a bug, possibly related to caching of serializers (or resolution via |
Hi @cowtowncoder @JooHyukKim , I have pushed a fix for it, can you please review, Thanks, |
@JsonUnwrapped
annotation using shared vs. new ObjectMapper
instances
Actually, I'm pretty sure this is dup of #2461 so will close as such, keep earlier one. Fixed by same PR. |
Search before asking
Describe the bug
I am using Jackson version 2.16.1 and have encountered a peculiar behavior. According to the API documentation, it is recommended to use a common ObjectMapper instance. However, I observe different serialization results when using a shared instance versus a new instance. I have reproduced this issue with a simple example.
Output--
The output of the last two lines should be the same, but this is not the case. It appears that the @JsonUnwrapped annotation’s previous value for the Third class is being cached somewhere.
public class First { @JsonUnwrapped(prefix = "") final Thrid thrid = new Thrid(); }
If I use a non-empty string instead of an empty one in the above class, the results are consistent. Can someone please help us with this?
Version Information
2.14.2, 2.16.1, 2.17.2
Reproduction
<-- Any of the following
-->
Expected behavior
Object mapper shared object should behave same as new instance as there is no configuration involved
Additional context
No response
The text was updated successfully, but these errors were encountered: