I have added the JavaTimeModule but still not able to get OffsetDateTime working on getting some data from RethinkDB @Configuration public class JacksonOffsetDateTimeMapper{
@Bean
@Primary
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
return builder.build()
.registerModule(new JavaTimeModule());
}
}
Gradle dependencies for jackson: implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names', version: '2.13.1'
Objects which are not manage by Spring and use "new ObjectMapper()" instead of autowiring it, will still face that issue. I was facing this issue while configuring a MappingJackson2MessageConverter to use with JMS, so in this case I had to set the ObjectMapper explicitly to the MappingJackson2MessageConverter object, as shown below.
In case there is already an ObjectMapper managed by Spring, we can just inject the ObjectMapper in the messageConvert, like below.