ResponseEntity結果為linkedHashMap?報型別轉換異常
阿新 • • 發佈:2019-02-18
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()+"×=" +qcReportbillNcVo.getTimes(), HttpMethod.GET, null, new ParameterizedTypeReference<List<QcReportbillNc>>(){}); if (exchange.getStatusCode() == HttpStatus.OK) { return exchange.getBody(); }
List<QcReportbillNc> nclist = exchange.getBody()