| | |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; |
| | |
| | | public class SpringBeanConfiguration { |
| | | |
| | | @Bean |
| | | @ConditionalOnMissingBean(ObjectMapper.class) |
| | | // @ConditionalOnMissingBean(ObjectMapper.class) |
| | | public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) { |
| | | ObjectMapper objectMapper = builder.createXmlMapper(false).build(); |
| | | objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); |
| | |
| | | objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); |
| | | objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); |
| | | objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); |
| | | objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() { |
| | | @Override |
| | | public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException { |