Spring-Boot 0.5.0.BUILD-SNAPSHOT and customer Json MappingJackson2HttpMessageConverter

By : brulejr
Source: Stackoverflow.com
Question!

Has anyone working with Spring-Boot figured out how to override the default Jackson ObjectMapper that is automatically configured? I have tried to instantiate both the ObjectMapper as a bean and within a MappingJackson2HttpMessageConverter also as a been. But with no success...

Any thoughts?

By : brulejr


Answers

Spring handles HTTP @ResponseBody using the HttpMessageConverter abstraction, so it's there that you would have to add customizations. Normally you would add a @Bean extending WebMvcConfigurerAdapter and override the configureMessageConverters() method.

Adding a @Bean of type ObjectMapper sounds like a neat way to do this for a Spring Boot application, so you could provide that feature in a pull request if you like.

By : Dave Syer


This video can help you solving your question :)
By: admin