I try not to using any xml.
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
    <property name="messageConverters">
        <list>
            <bean class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
                <property name="marshaller" ref="jaxbMarshaller"/>
                <property name="unmarshaller" ref="jaxbMarshaller"/>
            </bean>
            <bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
        </list>
    </property>
</bean>
like this one: convert to @Bean
@Bean
public RestTemplate restTemplate() {
    RestTemplate restTemplate = new RestTemplate();
    List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
    converters.add(marshallingMessageConverter());
    restTemplate.setMessageConverters(converters);
    return restTemplate;
}
Problem here.
<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="classesToBeBound">
        <list>
            <value>com.cloudlb.domain.User</value>
        </list>
    </property>
</bean>
Try to convert "com.cloudlb.domain.User" into Class [] not thing work.
@Bean
public MarshallingHttpMessageConverter marshallingMessageConverter() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    //
    List<Class<?>> listClass = new ArrayList<Class<?>>();
    listClass.add(User.class);
    marshaller.setClassesToBeBound((Class<?>[])listClass.toArray());
    // --------------------------------
    return new MarshallingHttpMessageConverter(marshaller, marshaller);
}
Error: problem with casting.
Thank you in advance.
` be converted to a `List` rather than an array?
– Thomas Jan 03 '12 at 20:12` will be coerced to whatever is necessary, e.g. `List`, or array.
– skaffman Jan 03 '12 at 20:16