title: Converting Spring XML to JavaConfig
body: <p>I want to convert the following spring beans from xml to a javaconfig class:</p>
  
  <pre><code>&lt;bean id="restTemplate" class="org.springframework.security.oauth2.client.OAuth2RestTemplate"&gt;
      &lt;constructor-arg ref="resource"/&gt;
      &lt;property name="messageConverters"&gt;
          &lt;list&gt;
              &lt;ref bean="jaxbMessageConverter" /&gt;
              &lt;ref bean="stringHttpMessageConverter" /&gt;
              &lt;ref bean="jsonConverter" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="resource" class="org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordResourceDetails"&gt;
      &lt;property name="username" value="asdfasdf" /&gt;
      &lt;property name="password" value="asdfasdfa" /&gt;
      &lt;property name="clientId" value="asdfasdf-asdfas-asdfasf" /&gt;
      &lt;property name="clientSecret" value="asdfasdf-asdfasdf-adfasdfd" /&gt; 
      &lt;property name="accessTokenUri" value="asdfsadfasd" /&gt;
      &lt;property name="grantType" value="password"&gt;&lt;/property&gt;
      &lt;property name="clientAuthenticationScheme" value="form" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>How exactly would you convert this? I came across <a href="https://blog.frankel.ch/consider-replacing-spring-xml-configuration-with-javaconfig" rel="nofollow">this example</a> but it's kind of confusing because it doesn't really make sense to me how the <code>&lt;constructor-arg...&gt;</code> and <code>&lt;property....&gt;</code> tags are represented in java. In the example they both translate to:</p>
  
  <pre><code>return new JButton(...);
  </code></pre>