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

Add class hints for Jackson annotations on fields and methods #30208

Closed
tuckeremulls opened this issue Mar 27, 2023 · 2 comments
Closed

Add class hints for Jackson annotations on fields and methods #30208

tuckeremulls opened this issue Mar 27, 2023 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@tuckeremulls
Copy link

tuckeremulls commented Mar 27, 2023

@JsonDeserialize(using=MyCustomLocalDateDeserializer.class) does not seem to be working in my project using Spring 3.0.4 and GraalVM latest. It works fine when running the project in my IDE to test, but fails with the following exception when running the image:

No default constructor found

Even though there is a default constructor defined in my implementation:

public class MyCustomLocalDateDeserializer extends StdDeserializer<LocalDate> {

    public MyCustomLocalDateDeserializer() {

        this(null);
    }

    public MyCustomLocalDateDeserializer(Class<LocalDate> t) {

        super(t);
    }

    @Override
    public LocalDate deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {

        ...
    }

}

I have placed the annotation on the field of a response object coming back from a web client call:

public class SomeResponseObject {

    @JsonDeserialize(using = MyCustomLocalDateDeserializer.class)
    private LocalDate someDate;
    ...

}

Does support for this not exist yet? I saw the below threads but was unsure if this specific case had been encountered yet.

#29646
#29386

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 27, 2023
@sdeleuze sdeleuze self-assigned this Mar 28, 2023
@sdeleuze sdeleuze added the theme: aot An issue related to Ahead-of-time processing label Mar 28, 2023
@sdeleuze
Copy link
Contributor

I need to have a deeper look, but given the 2 issues you linked I would expect this to be supported. Could you please share a reproducer?

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Mar 28, 2023
@tuckeremulls tuckeremulls changed the title @JsonDeserialize(using=...) not working with Native Image @JsonDeserialize(using=...) not working with Native Image Mar 29, 2023
@tuckeremulls
Copy link
Author

I need to have a deeper look, but given the 2 issues you linked I would expect this to be supported. Could you please share a reproducer?

Yes here is a small replication of the issue: https://github.com/tuckeremulls/jsondeserialization-native-image-sample/tree/main

Thanks so much!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 29, 2023
@sdeleuze sdeleuze added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Mar 31, 2023
@sdeleuze sdeleuze added this to the 6.0.8 milestone Mar 31, 2023
@sdeleuze sdeleuze changed the title @JsonDeserialize(using=...) not working with Native Image Add class hints for Jackson annotations on fields and methods Mar 31, 2023
@sdeleuze sdeleuze added type: enhancement A general enhancement and removed type: bug A general bug labels Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants