문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
springframework:springboot:json [2018/11/27 15:16] kwon37xi |
springframework:springboot:json [2020/11/23 19:00] (현재) kwon37xi [WRITE_DATES_AS_TIMESTAMPS=false 사용] |
||
|---|---|---|---|
| 줄 7: | 줄 7: | ||
| ==== 기본 설정 ==== | ==== 기본 설정 ==== | ||
| - | * 의존성에 다음 추가해야 JSR310 날짜/ | + | * SpringBoot 2.x 는 starter 추가 하면 Jackson '' |
| + | api ' | ||
| + | </ | ||
| + | * 구버전 SpringBoot 에서는 | ||
| compile(' | compile(' | ||
| compile(' | compile(' | ||
| 줄 42: | 줄 45: | ||
| spring.jackson.serialization.write-dates-as-timestamps: | spring.jackson.serialization.write-dates-as-timestamps: | ||
| </ | </ | ||
| - | * SpringBoot 2.x 는 이값이 **기본 '' | + | * SpringBoot 2.x 는 이값이 **기본 '' |
| + | * **'' | ||
| * 이렇게 하면 '' | * 이렇게 하면 '' | ||
| { | { | ||
| 줄 115: | 줄 119: | ||
| }</ | }</ | ||
| * '' | * '' | ||
| + | |||
| + | ==== Jackson2ObjectMapperBuilder 사용시 Module 추가 ==== | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| ==== @EnableWebMvc ==== | ==== @EnableWebMvc ==== | ||
| '' | '' | ||
| 줄 148: | 줄 157: | ||
| } | } | ||
| // 파라미터를 ? | // 파라미터를 ? | ||
| + | </ | ||
| + | |||
| + | ==== @JsonComponent ==== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ==== WebFlux Jackson 설정 ==== | ||
| + | * [[springframework: | ||
| + | * '' | ||
| + | * https:// | ||
| + | |||
| + | <code java> | ||
| + | @Configuration | ||
| + | public class Config implements WebFluxConfigurer, | ||
| + | @Override | ||
| + | public void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) { | ||
| + | jacksonObjectMapperBuilder | ||
| + | .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) | ||
| + | .timeZone(TimeZone.getDefault()) | ||
| + | .locale(Locale.getDefault()) | ||
| + | .simpleDateFormat(" | ||
| + | } | ||
| + | } | ||
| </ | </ | ||
| 줄 156: | 줄 188: | ||
| * [[http:// | * [[http:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||