Created
September 27, 2016 20:03
-
-
Save jhoelter/4b074e91fcc683fb922d5ad66b34bb11 to your computer and use it in GitHub Desktop.
JacksonConfig for HATEOAS
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
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import com.fasterxml.jackson.databind.SerializationFeature; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.context.annotation.Primary; | |
| import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | |
| /** | |
| * Created by jeremie.hoelter on 27.09.2016. | |
| */ | |
| @Configuration | |
| public class JacksonConfiguration { | |
| @Bean | |
| @Primary | |
| public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) { | |
| ObjectMapper objectMapper = builder.createXmlMapper(false).build(); | |
| objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); | |
| return objectMapper; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment