Created
April 27, 2020 10:03
-
-
Save CheolhoJeon/7def5103d92fbc24ea5c276866db602e to your computer and use it in GitHub Desktop.
This file contains 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
@Configuration | |
@EnableWebMvc | |
public class MvcConfig implements WebMvcConfigurer { | |
... | |
@Override | |
public void extendMessageConverters(final List<HttpMessageConverter<?>> converters) { | |
DateTimeFormatter formatter = DataTimeFormatter.ofPattern("yyyyMMddHHmmss"); | |
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder | |
.json() | |
.featureToEnable(SerializationFeature.INDENT_OUTPUT) | |
.deserializerByType(LocalDateTime.class, new LocalDateTimeDeserializer(formatter)) | |
.simpleDateFormat("yyyyMMddHHmmss") | |
.build(); | |
converters.add(0, new MappingJackson2HttpMessageConverter(objectMapper)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment