File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
backend/src/main/java/com/accord/config Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .accord .config ;
2+
3+ import com .fasterxml .jackson .databind .ObjectMapper ;
4+ import com .fasterxml .jackson .databind .SerializationFeature ;
5+ import com .fasterxml .jackson .datatype .jsr310 .JavaTimeModule ;
6+ import org .springframework .context .annotation .Bean ;
7+ import org .springframework .context .annotation .Configuration ;
8+ import org .springframework .context .annotation .Primary ;
9+
10+ /**
11+ * Jackson configuration to properly serialize Java 8 date/time types
12+ */
13+ @ Configuration
14+ public class JacksonConfig {
15+
16+ @ Bean
17+ @ Primary
18+ public ObjectMapper objectMapper () {
19+ ObjectMapper mapper = new ObjectMapper ();
20+ // Register JavaTimeModule to handle Java 8 date/time types
21+ mapper .registerModule (new JavaTimeModule ());
22+ // Serialize dates as ISO-8601 strings instead of arrays
23+ mapper .disable (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS );
24+ return mapper ;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments