-
Notifications
You must be signed in to change notification settings - Fork 614
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
Exception when serializing java.time.Instant
properties annotated with @JsonFormat
#2980
Comments
@acisternino, could you provide a minimal application where we can reproduce the issue? Thanks! |
Yes, but I might need a couple of days. |
Backport to 4.1.x. |
I am not sure what we can do here as Instant could not be serialized without specifying Timezone.
. . . however if you add
|
Also, you can see that you don't need much to reproduce it
|
@acisternino Have you seen my last comment? We will certainly fix the Let me know your thoughts |
Hi @olegz I agree. the correct behavior is to specify the timezone in the annotation. I don't know why it used to work before. Maybe Jackson was more lenient in a previous release. Thank you for the support. I think this can be closed. |
In our app we'd like to annotate a bean's
j.t.Instant
property with Jackson's@JsonFormat
in order to have a precise format that's needed by the message receiver.In particular, the annotated property is this:
However, when sending a
Message
containing the aforementioned bean we get an exception:The demo application I used to get the stack trace is a very simple Spring Boot project where a simple controller reacts to a POST request by creating a Message and sending it with the default StreamBridge to a simple output binding to a RabbitMQ broker.
This is the code in the controller's method:
Spring Cloud configuration:
Versions
Notes
The stange thing is that
java.util.Date
and otherjava.time
classes work as expected!The issue is specific of
java.time.Instant
.The same happens with Spring Boot 3.3.1 and/or Spring Cloud 2023.0.2.
Possibly related to spring-cloud/spring-cloud-function#1189?
The text was updated successfully, but these errors were encountered: