我尽量不使用任何xml.
像这样:转换为@Bean
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
List
问题在这里.
尝试将“com.cloudlb.domain.User”转换为Class []而不是工作.
@Bean
public MarshallingHttpMessageConverter marshallingMessageConverter() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
//
List
错误:投射问题.
先感谢您.
最佳答案
@Bean
public MarshallingHttpMessageConverter marshallingMessageConverter() {
return new MarshallingHttpMessageConverter(
jaxb2Marshaller(),jaxb2Marshaller()
);
}
@Bean
public Jaxb2Marshaller jaxb2Marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setClassesToBeBound(new Class[]{
twitter.model.Statuses.class
});
return marshaller;
}