2a54a3b03275ce05c1bc9963928d55cc1a72c419
[SpringWebServicesForFun/.git] /
1 package de.spring.webservices.configuration;
2
3 import javax.inject.Inject;
4
5 import org.springframework.context.annotation.Configuration;
6
7 import com.fasterxml.jackson.databind.DeserializationFeature;
8 import com.fasterxml.jackson.databind.MapperFeature;
9 import com.fasterxml.jackson.databind.ObjectMapper;
10 import com.fasterxml.jackson.databind.SerializationFeature;
11 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
12
13 @Configuration
14 public class JacksonConfiguration {
15
16   @Inject
17   public void configureJackson(ObjectMapper jackson2ObjectMapper) {
18           jackson2ObjectMapper
19                 .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
20         .disable(MapperFeature.DEFAULT_VIEW_INCLUSION)
21         .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
22         .enable(SerializationFeature.INDENT_OUTPUT)
23         .registerModule(new JavaTimeModule());
24   }
25   
26 }