title: How to customise the Jackson JSON mapper implicitly used by Spring Boot?
body: <p>I'm using Spring Boot (1.2.1), in a similar fashion as in their <a href="http://spring.io/guides/gs/rest-service/" rel="noreferrer">Building a RESTful Web Service</a> tutorial:</p>
  <pre class="lang-java prettyprint-override"><code>@RestController
  public class EventController {
     @RequestMapping(&quot;/events/all&quot;)
     EventList events() {
         return proxyService.getAllEvents();
     }
  }
  </code></pre>
  <p>So above, Spring MVC implicitly uses Jackson for serialising my <code>EventList</code> object into JSON.</p>
  <p>But I want to do some simple customisations to the JSON format, such as:</p>
  <pre class="lang-java prettyprint-override"><code>setSerializationInclusion(JsonInclude.Include.NON_NULL)
  </code></pre>
  <p>Question is, <strong>what is the simplest way to customise the implicit JSON mapper?</strong></p>
  <p>I tried the approach in <strong><a href="http://magicmonster.com/kb/prg/java/spring/webmvc/jackson_custom.html" rel="noreferrer">this blog post</a></strong>, creating a CustomObjectMapper  and so on, but the step 3, &quot;Register classes in the Spring context&quot;, fails:</p>
  <pre class="lang-none prettyprint-override"><code>org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'jacksonFix': Injection of autowired dependencies failed; 
    nested exception is org.springframework.beans.factory.BeanCreationException: 
    Could not autowire method: public void com.acme.project.JacksonFix.setAnnotationMethodHandlerAdapter(org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter); 
    nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: 
    No qualifying bean of type [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter]   
    found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  </code></pre>
  <p>It looks like those instructions are for older versions of Spring MVC, while I'm looking for a simple way to get this working with latest Spring Boot.</p>