Spring RestTemplate和XMLStream与对象列表一起使用
|
我正在尝试使用ѭ0来检索Employee记录列表,例如:
.... employee>
.... employee> employees>
因此,当执行上述方法时,出现以下错误:
public List<Employee> getEmployeesByFirstName(String firstName) {
return restTemplate.getForObject(employeeServiceUrl + \"/firstname/{firstName}\", List.class, firstName);
}
问题是Web服务(被调用)返回以下XML格式:
org.springframework.http.converter.HttpMessageNotReadableException: Could not read [interface java.util.List]; nested exception is org.springframework.oxm.UnmarshallingFailureException: XStream unmarshalling exception; nested exception is com.thoughtworks.xstream.mapper.CannotResolveClassException: **employees : employees**
没有找到相关结果
已邀请:
4 个回复
断跑胺弄萎
应该使用自动编组正确地编组。
掸牛浓疗
砷竣阿
广躺椽
确保正确注释了您的Domain对象,并在类路径中添加了XMLStream jar。它必须满足以上条件才能工作。