首页 > 其他 > 详细

RestTemplate 返回值嵌套范型解析

时间:2021-07-15 17:27:33      阅读:25      评论:0      收藏:0      [点我收藏+]

接口返回值定义如下:ResponseEntity<ValuationResponseEntity<DealChangeNotifyVO>>

1 ParameterizedTypeReference<ValuationResponseEntity<DealChangeNotifyVO>> typeRef = new ParameterizedTypeReference<ValuationResponseEntity<DealChangeNotifyVO>>() {};
2 HttpHeaders headers = new HttpHeaders();
3 headers.setContentType(MediaType.APPLICATION_JSON);
4 headers.set("Accept", "application/json");
5 HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
6 ResponseEntity<ValuationResponseEntity<DealChangeNotifyVO>> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, typeRef);
7 return response;

 




RestTemplate 返回值嵌套范型解析

原文:https://www.cnblogs.com/xushy/p/15015400.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!