Last active
April 27, 2020 07:30
-
-
Save CheolhoJeon/6259b263dc9a0e3c4465aeb8aecc82ea 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
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.SerializationFeature; | |
... | |
import org.springframework.http.converter.HttpMessageConverter; | |
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | |
@Configuration | |
@EnableWebMvc | |
public class MvcConfig implements WebMvcConfigurer { | |
... | |
@Override | |
public void extendMessageConverters(final List<HttpMessageConverter<?>> converters) { | |
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder | |
.json() | |
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) | |
.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