Tim Schraepen
06/04/2024, 9:33 PMorg.springframework.web.servlet.function.RouterFunctionDsl
?
Because it doesn't seem to be the default configured objectmapper.
I just ran into a very annoying problem while livecoding.
I was getting json responses where a LocalDateTime was being converted into a [2024,6,4,....] format instead of a "2024-06-04T...." format, which is supposedly the default date-format of spring's configured Jackson ObjectMapper.
I ended up injecting the default ObjectMapper and doing conversion myself:
ServerResponse.ok()
.contentType(MediaType.APPLICATION_JSON)
.body(foundQuotes.toJson())
What am I missing?Tim Schraepen
06/04/2024, 9:34 PMTim Schraepen
06/04/2024, 9:34 PMkqr
06/05/2024, 1:09 PMTim Schraepen
06/05/2024, 1:22 PMTim Schraepen
06/05/2024, 1:27 PMkqr
06/05/2024, 1:33 PMTim Schraepen
06/05/2024, 1:37 PMkqr
06/05/2024, 1:40 PMTim Schraepen
06/05/2024, 3:39 PMTim Schraepen
06/05/2024, 3:40 PMdefaultObjectMapper
of the AbstractJackson2HttpMessageConverter
.
You'd think it's the same one as the
@Primary
@Bean
fun objectMapper() = jacksonObjectMapper()
David Kubecka
06/12/2024, 7:55 AMTim Schraepen
06/12/2024, 8:08 AMDavid Kubecka
06/12/2024, 8:14 AMDavid Kubecka
06/12/2024, 8:15 AMDavid Kubecka
06/12/2024, 8:20 AMTim Schraepen
06/12/2024, 8:31 AMI just ran into a very annoying problem while livecoding.
I was getting json responses where a LocalDateTime was being converted into a [2024,6,4,....] format instead of a "2024-06-04T...." format, which is supposedly the default date-format of spring's configured Jackson ObjectMapper.
Tim Schraepen
06/12/2024, 8:32 AMTim Schraepen
06/12/2024, 8:32 AMkqr
06/12/2024, 9:16 AMkqr
06/12/2024, 9:19 AMDavid Kubecka
06/12/2024, 9:24 AMobjectMapper.writeValueAsString(request.body)
has the dates formatted as expected. It's somewhere deep inside the request processing (before it is sent over the wire) that a misconfigured objectMapper is used.kqr
06/12/2024, 9:25 AMkqr
06/12/2024, 9:26 AMDavid Kubecka
06/12/2024, 9:36 AM@EnableWebMvc
, at least not directly. Will keep digging.Tim Schraepen
06/12/2024, 8:51 PM