PageRenderTime 44ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/dubbo-common/src/main/java/com/alibaba/dubbo/common/json/DefaultJacksonObjectMapperProvider.java

https://gitlab.com/sxyseo/dubbox
Java | 22 lines | 15 code | 3 blank | 4 comment | 0 complexity | bcf5140cfea5041e6db62ab74bd93d27 MD5 | raw file
  1. package com.alibaba.dubbo.common.json;
  2. import com.fasterxml.jackson.databind.DeserializationFeature;
  3. import com.fasterxml.jackson.databind.ObjectMapper;
  4. import com.fasterxml.jackson.databind.SerializationFeature;
  5. import java.util.TimeZone;
  6. /**
  7. * @author dylan
  8. */
  9. public class DefaultJacksonObjectMapperProvider implements JacksonObjectMapperProvider {
  10. @Override
  11. public ObjectMapper getObjectMapper() {
  12. ObjectMapper objectMapper = new ObjectMapper();
  13. objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
  14. // objectMapper.disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE);
  15. objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
  16. objectMapper.setTimeZone(TimeZone.getDefault());
  17. return objectMapper;
  18. }
  19. }