[英]Spring RestTemplate, return List<String>
Is it possible to return a List<String>
as a JAXB
response directly without wrapping it in a response object? 是否可以直接将
List<String>
作为JAXB
响应返回而不将其包装在响应对象中? Eg, 例如,
public List<String> foo(Bar bar) {
return restTemplate.postForEntity("http://foo.com/bar", bar, List.class);
}
Currently I get the error 目前我收到错误
Could not write request: no suitable HttpMessageConverter found for request type [my.pkg.Bar]
无法写入请求:找不到合适的HttpMessageConverter请求类型[my.pkg.Bar]
The HttpMessageConverters are properly configured as other GET/POST requests with Bar
works. HttpMessageConverters 已正确配置为
Bar
工作的其他GET / POST请求。
我只能使用String [] .class作为类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.