-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
@JsonDeserialize(builder = ...)
does not work in GraalVM native image
#29646
Comments
If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem. |
@mhalbritter |
Please, you can take a look into test.zip. I got an error as I mentioned below.
You can use below curl to reproduce the issue.
|
com.demo.Test$Builder
does not have build method (name: 'build')
Thanks for the sample. It looks like that the Jackson builder feature is not supported yet. @JsonDeserialize(builder = Test.Builder.class) You can either remove the builder or register the ctor and methods from your builder to be reflection-enabled: class TestresourceRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
hints.reflection().registerType(Test.Builder.class, MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
}
} and then use
on any bean. |
@JsonDeserialize(builder = ...)
does not work in GraalVM native image
If we address this issue, I think we should reopen #29386 and address it as well. |
As part of this issue, we should consider whether we want to introduce specific AOT rules for Jackson. Since there are many features and variants in Jackson, I'm not sure we should invest in that area. |
We could expand the scope of our This means supporting various features like:
We could also refine the binding algorithm to include/ignore All of that should also support custom annotations with With that in mind, I'm not in favor of implementing Jackson-specific behavior, but keep using our general "reflection for binding" that matches a lot of cases already. I think this should be handled in a GraalVM |
I agree on not implementing Jackson-specific behavior. |
On one side I understand our reluctance related to the maintenance burden especially given the various annotations we would have to support, on another side:
Since |
I agree that not doing anything additional for Jackson use cases will put a large burden on our users. If the Jackson team some day introduces a GraalVM So, if we can make a big improvement with such a small change like you've proposed Sebastien, I am in favor of that. |
Overview
We update our spring boot version to 3.0.0 and build native image with below mentioned grallvm version.
While call the API which use Jackson-databind annotation then it will return with an error.
Related Issues
@RegisterReflectionForBinding
should register hints for Jackson annotations #29426@JsonNaming
strategy is not supported in GraalVM native image #29386The text was updated successfully, but these errors were encountered: