1. 程式人生 > >ResponseEntity結果為linkedHashMap?報型別轉換異常

ResponseEntity結果為linkedHashMap?報型別轉換異常

ResponseEntity<List> exchange = restTemplate().exchange("http://127.0.0.1:8080", HttpMethod.GET, entity,List.class)    ;

結果始終為linkedHashMap???

解決方法:

@Bean
@LoadBalanced
RestTemplate restTemplate() {
    return new RestTemplate();
}
ResponseEntity<List<QcReportbillNc>> exchange = restTemplate()
        .exchange("http://127.0.0.1:8080/getNC?createTime="
+qcReportbillNcVo.getCreateTime()+"&code=" +qcReportbillNcVo.getCode()+"&workshopPK=" +qcReportbillNcVo.getWorkshopPK()+"&times=" +qcReportbillNcVo.getTimes(), HttpMethod.GET, null, new ParameterizedTypeReference<List<QcReportbillNc>>(){}); if (exchange.getStatusCode() == HttpStatus.OK
) { return exchange.getBody(); }
List<QcReportbillNc> nclist = exchange.getBody()