-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
Default Mixin added by Jackson2ObjectMapperBuilder are missing required runtime hints #31606
Comments
@denysandriyanov thanks for the report, but unfortunately I can't reproduce this with: problemDetail.setProperty("userId", UUID.randomUUID().toString());
problemDetail.setProperty("traceId", UUID.randomUUID().toString());
Rather than the output, we'd need a small sample that we can run ourselves to understand how your use case differs. You can attach a zip to this issue or push the code to a separate GitHub repository. |
to give a bit more context. I am building ProblemDetail like this
and then i return it in ExceptionHandler
The Exception is
Where Object properties in my example is Map<String, Object> with key="userId", value="d44cdf72-8417-5963-85ae-f1936288ae82" Hope that helps. Also, just make sure you use Native Image build |
Not really. We'd need to move all that code in text into something that we can run and, as we do, we may miss a step that you're not showing. As I've asked before, can you please share a sample project we can run ourselves, not code snippet in text. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Please see attached reproducer.zip As a side note, as a description for setProperty method in ProblemDetail there is When Jackson JSON is present on the classpath, any properties set here are rendered as top level key-value pairs in the output JSON. Otherwise, they are rendered as a "properties" sub-map. May be in native image it can not detect it? |
@denysandriyanov unfortunately, the entire application is not what I have in mind. It doesn't even start for me:
I am looking at the code and I don't even see what creates |
Please see attached. There is a DummyController.java class, when you call it it will throw |
@denysandriyanov I am happy to try to help but please make sure this can be started? The application does not start (and doesn't require Java 20 either):
also make sure |
Nevermind. I ripped out 90% of the config and the reproducer didn't even enabled problem details. I've managed to reproduce it in demo project by adding a nested map that I overlooked. Courtesy of @rstoyanchev, it looks like |
The framework registers custom Mixin but does not provide the necessary hints as Spring Boot does for scanned mixins. In the meantime, you can workaround the problem by adding the following your your custom hints: new BindingReflectionHintsRegistrar().registerReflectionHints(hints.reflection(),
ProblemDetailJacksonMixin.class); |
Affects: 3.1.5
Hello.
I am using
id 'org.springframework.boot' version '3.1.5'
and
id 'org.graalvm.buildtools.native' version '0.9.27'
When making a rest response with ProblemDetail that contain some property it is expected that this property will be rendered as top level key-value pair in the output JSON, and it does work so in JVM mode.
While in native image it will always return properties like a "properties" sub map.
Please see example below:
The text was updated successfully, but these errors were encountered: