spring-modulith icon indicating copy to clipboard operation
spring-modulith copied to clipboard

Java 8 date/time type `java.time.Instant` not supported by default

Open thestroke82 opened this issue 1 year ago • 3 comments

The serializer needs datatype-jsr310. I apologize in advance if it's already been reported.

thestroke82 avatar Apr 24 '24 13:04 thestroke82

I am assuming you're referring to the Jackson ObjectMapper used to serialize the event instances? That one is picked up from Boot's default setup. The fallback we declare picks up all Module beans from the ApplicationContext. In other words, if the JSR-310 module is on the classpath it should be registered through Boot.

If that doesn't work, would you mind creating a minimal reproducer for us to investigate?

odrotbohm avatar Apr 29 '24 06:04 odrotbohm

Yes I am referring to the Jackson ObjectMapper. In fact jackson-datatype-jsr310 was already present in the classpath, but i still got the error. I'll try to reproduce it but really it was no special configuration: some standard Boot starters, js310 and spring-modulith-events-api . I get the error when I try to publish an event.

thestroke82 avatar Apr 29 '24 07:04 thestroke82

You might want to debug into JacksonEventSerializationConfiguration.jacksonEventSerializer(…) and see whether the ObjectProvider contains a preconfigured instance.

odrotbohm avatar Apr 29 '24 07:04 odrotbohm

Closing as there's not been any development for quite a while.

odrotbohm avatar Sep 24 '24 09:09 odrotbohm