-
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
Cannot customize Jackson serializer and deserializer for java.time.Instant #33775
Comments
Does this issue still occur with Quarkus |
After a |
Thanks for the update |
Uh, I might have found the issue :) I think the default comparison implementation for
|
As mentioned in the Javadoc of
So as you found, in order for your serializers to be used, the customizer needs to be run after the run Quarkus has by default that registers the |
Ah, that explains it! The documentation around |
🙏 |
Describe the bug
I am trying to create a custom Jackson serializer + deserializer for some java.time types in an existing Quarkus 2 API to help break up the migration to Quarkus 3 in smaller less risky deployments. I'm using the
ObjectMapperCustomizer
interface to add my custom serializer + deserializer however during testing I can never seem to get my implementations used. I've even tried maxing out the priority of the customizer in case it was completing with the priority of internal customizers.Expected behavior
I'd expect that my custom serializer and deserializer should be preferred across the API when dealing with the
Instant
type.Actual behavior
Another implementation of a serializer and deserializer is used instead.
How to Reproduce?
In general it just involves creating a
ObjectMapperCustomizer
that registers aSimpleModule
with a customStdSerializer<Instant>
andStdDeserializer<Instant>
. I've created a small reproducible repo here to help aid tracking this one down.Output of
uname -a
orver
Linux tester 5.19.0-43-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.6" 2023-01-17 LTS OpenJDK Runtime Environment Corretto-17.0.6.10.1 (build 17.0.6+10-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.6.10.1 (build 17.0.6+10-LTS, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.16.4.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
Very odd but if I add this line after registering my module in
JacksonCustomizer
my serializer seems to get used. Adding calls likecanDeserialize
hasn't helped me hack the use of my deserilizer into play.The text was updated successfully, but these errors were encountered: