This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer(JacksonProperties jacksonProperties) { | |
return jacksonObjectMapperBuilder -> { | |
String dateFormatStr = jacksonProperties.getDateFormat(); | |
DateTimeFormatter formatter = | |
FanStringUtil.isNotBlank(dateFormatStr) ? DateTimeFormatter.ofPattern(dateFormatStr) : null; | |
jacksonObjectMapperBuilder.modules( | |
new JavaTimeModule() | |
.addSerializer(LocalDate.class, new LocalDateSerializer(formatter)) | |
.addSerializer(LocalTime.class, new LocalTimeSerializer(formatter)) |