-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
ObjectMapperCustomizer only evaluated at build time if resteasy-reactive-jackson or rest-client-reactive-jackson present #32969
Comments
/cc @FroMage (resteasy-reactive), @Sgitario (rest-client,resteasy-reactive), @cescoffier (rest-client), @geoand (jackson,rest-client,resteasy-reactive), @gsmet (jackson), @stuartwdouglas (resteasy-reactive) |
Does this problem only happen in native mode? |
Yes this only happens in native mode. In Jvm mode I do not see the log at built time, only at runtime, with the right value |
Understood, thanks |
#33189 takes care of it |
Ensure that ObjectMapperCustomizer impls are used in runtime init
@geoand I dont understand how yet, but this is not fixed in my application. I have tried on the reproducer, and the fix indeed works, but in my main app I still see the class being initialized at build time and not at runtime. I have added the following I have also tried to add al pom dependencies from may app to the reproducer, and enhance a little the reproducer but the reproducer still works fine, the main app doesn't. |
Not off hand unfortunately |
@geoand sorry for the ping again. Does that help? Still unsure how to have a reproducer for it but was able to get that stacktrace;
|
I have updated the previous reproducer here; https://github.com/manofthepeace/quarkus-jackson-buildtime-issue To reproduce you can follow steps in OP. Thank you |
I'll have a look in a few days |
I am not sure what I am supposed to be looking at to see the updated problem in action. |
Sorry for the lack of information. Problem is only for native but lets compare; If you run this way (not native) in native while building this log is shown when using The following exception is thrown (please note the exception I had pasted above (with my main app) is using
Please let me know if anything and thank you for your time. |
Gotcha, thanks |
This seems to be caused by the presence of the prometheus metrics extension, but I still haven't dug deep enough to know what we can do about it. |
I tried removing the extension from the reproducer and the same happens. I was more under the impression it was in resteasy somewhere since it started to happen in the reproducer once I did an api that took or returned a jackson entity, returning or taking a String for example did not cause the issue as I recall. |
can this be reopened? |
@geoand do you think this could have another look? I have updated the reproduce here: https://github.com/manofthepeace/quarkus-jackson-buildtime-issue to use latest quarkus 3.17 and removed a bunch of extensions. To recap. ObjectMapperCustomizer does not get evaluated at run time when using native. During my lasts tests it led to the classes the reproducer was able to reproduce the "basic" bodywrittrer issues, while my real app gets the "fully" unsure what triggers that, but cause seem to be similar. graal used: when running I find this is kind of risky when getting this bug as jvm behaviour differs from native without much indications. |
Hopefully some time next week |
Looked into it really briefly but didn't find anything worthwhile, so this needs more time |
Describe the bug
I would like to customize my object mapper depending on a configproperty. When I use the
quarkus-jackson
dependency it all works well, but if I use orquarkus-resteasy-reactive-jackson
orquarkus-rest-client-reactive-jackson
, it then make it evaluated only at build time using native, and it does not execute while running the app anymore.The only workaround I found is to have a basic singleton
@Startup
bean that re-customizes the Objectmapper.Expected behavior
ObjectMapperCustomizer should run at runtime event it it ran at buildtime so it can work with configproperty/configmapping.
via logs it should look like this at compile time;
[2/7] Performing analysis... [*******]
and running the app;
Actual behavior
ObjectMapper gets customized at buildtime only;
grallvm build;
[2/7] Performing analysis... [15:44:59,592 INFO [org.acm.RegisterCustomModuleCustomizer] Customizing objectMapper for default
app log;
nothing gets logged from the customizer
How to Reproduce?
Reproduce: https://github.com/manofthepeace/quarkus-jackson-buildtime-issue
Steps to reproduce
Output of
uname -a
orver
Darwin Kernel Version 21.6.0
Output of
java -version
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
GraalVM version (if different from Java)
21.3.1
Quarkus version or git rev
2.16.6
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.7
Additional information
No response
The text was updated successfully, but these errors were encountered: