XML : Converting Spring XML to JavaConfig

I want to convert the following spring beans from xml to a javaconfig class:

  <bean id="restTemplate" class="org.springframework.security.oauth2.client.OAuth2RestTemplate">      <constructor-arg ref="resource"/>      <property name="messageConverters">          <list>              <ref bean="jaxbMessageConverter" />              <ref bean="stringHttpMessageConverter" />              <ref bean="jsonConverter" />          </list>      </property>  </bean>    <bean id="resource" class="org.springframework.security.oauth2.client.token.grant.password.ResourceOwnerPasswordResourceDetails">      <property name="username" value="asdfasdf" />      <property name="password" value="asdfasdfa" />      <property name="clientId" value="asdfasdf-asdfas-asdfasf" />      <property name="clientSecret" value="asdfasdf-asdfasdf-adfasdfd" />       <property name="accessTokenUri" value="asdfsadfasd" />      <property name="grantType" value="password"></property>      <property name="clientAuthenticationScheme" value="form" />  </bean>    

How exactly would you convert this? I came across this example but it's kind of confusing because it doesn't really make sense to me how the <constructor-arg...> and <property....> tags are represented in java. In the example they both translate to:

  return new JButton(...);    

No comments:

Post a Comment