Jackson - configure override for collections via Jackson2ObjectMapperBuilderCustomizer
<p>I am customizing treatment of collections in my Jackson's object mapper in my Spring Boot config by constructing a new mapper like so</p>

<pre><code>@Configuration
public class Config {

@Autowired(required = true)
public void objectMapper(ObjectMapper mapper) {

    mapper.configOverride(Collection.class).setInclude(JsonInclude.Value.construct(JsonInclude.Include.NON_EMPTY, null));
    mapper.configOverride(List.class).setInclude(JsonInclude.Value.construct(JsonInclude.Include.NON_EMPTY, null));
    mapper.configOverride(Map.class).setInclude(JsonInclude.Value.construct(JsonInclude.Include.NON_EMPTY, null));

}
</code></pre>

<p>While this works, I understand that a more elegant approach is to use <code>Jackson2ObjectMapperBuilderCustomizer</code> :</p>

<pre><code>@Bean
public Jackson2ObjectMapperBuilderCustomizer customizeJackson2ObjectMapper() {
    return new Jackson2ObjectMapperBuilderCustomizer() {

        @Override
        public void customize(Jackson2ObjectMapperBuilder builder) {
            builder
            .indentOutput(true)
            .someOtherMethod(...)

        }
    };
}
</code></pre>

<p>How do I implement ObjectMapper collection tweaks above via Jackson2ObjectMapperBuilder ? </p>