title: Is there a better way to Configure Bean?
body: <p>Can the following Spring DI xml be improved? Below the xml is the programmatic approach of configuring the target bean.</p>
  
  <pre><code>&lt;bean id="jacksonObjectMapper" class="org.codehaus.jackson.map.ObjectMapper" /&gt;
  &lt;bean id="jacksonSerializationConfig" class="org.codehaus.jackson.map.SerializationConfig"
      factory-bean="jacksonObjectMapper" factory-method="getSerializationConfig" /&gt;
  &lt;bean
      class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"&gt;
      &lt;property name="targetObject" ref="jacksonSerializationConfig" /&gt;
      &lt;property name="targetMethod" value="setSerializationInclusion" /&gt;
      &lt;property name="arguments"&gt;
          &lt;list&gt;
              &lt;value type="org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion"&gt;NON_NULL&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <blockquote>
    <p>ObjectMapper mapper = new
    ObjectMapper();
           mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);</p>
  </blockquote>