dreamworker

Untitled

Sep 9th, 2020
1,150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1.     @Bean
  2.     public ObjectMapper objectMapper() {
  3.  
  4.         // ObjectMapper is threadsafe
  5.  
  6.         // allow convertation to/from Instant
  7.         ObjectMapper mapper = new ObjectMapper().registerModule(new JavaTimeModule());
  8.         // will write as string ISO 8601
  9.         mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
  10.  
  11.  
  12.         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
  13.         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
  14.         //mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
  15.         //mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  16.         //mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);
  17.         return mapper;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment