package io.pazuzu.registry.config; import java.text.SimpleDateFormat; import java.util.TimeZone; 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; import org.zalando.problem.ProblemModule; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; @Configuration public class MapperConfiguration { @Bean @Primary public Jackson2ObjectMapperBuilder objectMapperBuilder() { Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return builder .failOnUnknownProperties(false) .dateFormat(dateFormat) .serializationInclusion(Include.NON_NULL) .modules(new Jdk8Module(), new ProblemModule()); } }