Another question for the same project once mentioned in this question. We have now developed quite a few routes to serve a REST/JSON web service from a composite back-end.
The endpoint is an <int-http:inbound-gateway> that performs implicit JSON to object from the request and object to JSON for the response. Now we really need to tune Jackson to solve a few issues with the JSON we deliver in the responses. Nothing fancy or unusual: mostly, serve dates as String instead of Timestamps, removing null attributes, registering the JSR-310 module.
For the other modules in the platform, we use Java DSL with a @Configuration class and a bean like this:
@Configuration
public class ControllerConfig {
@Bean
@Primary
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.setSerializationInclusion(Include.NON_NULL);
return objectMapper;
}
}
But it seems to have no effect on Spring Integration. I have also tried Spring Boot configuration:
spring.jackson.default-property-inclusion=NON_NULL
and it does not work either. I read very carefully this thread and my understanding from Artem Bilan's answer is that indeed, Spring Integration does not consider the Spring Boot configuration.
So... I'm feeling stupid: what is the canonical way of configuring Jackson globally for Spring Integration ?
jackson 2.8.7 / spring 4.3.7 / spring boot 1.5.2 / spring integration 4.3.8