Skip to content
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

Set Jackson USE_PROPERTIES_BASED to no longer need @JsonCreator #32328

Closed
johanandren opened this issue Feb 23, 2024 · 2 comments
Closed

Set Jackson USE_PROPERTIES_BASED to no longer need @JsonCreator #32328

johanandren opened this issue Feb 23, 2024 · 2 comments
Assignees
Milestone

Comments

@johanandren
Copy link
Member

While digging into native image Jackson stuff I stumbled over ObjectMapper#setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED) which seems to behave as you'd expect/want for single field classes out of the box, so no annotation needed for case class Example(singleField: String).

We'd need to investigate but seems convenient if it doesn't have any negatives for normal usage.

Source article: https://cowtowncoder.medium.com/jackson-2-12-most-wanted-3-5-246624e2d3d0

@patriknw
Copy link
Member

Interesting, we should make use of that somehow. Might be dangerous in a patch release, but we could make it an opt-in and document it. I haven't ready the article in detail, so don't know if we need to add anything.

@johanandren
Copy link
Member Author

In the end it turned out to be a problem specific to how the Scala Jackson module tries to figure things out and no annotation is actually needed. Maybe it is still needed and this is interesting for Java, not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants