String url = "http://www.test.com/Order/update";
Map<String,Object> chatMap = new HashMap<>();
chatMap.put("orderId",order.get("id"));
chatMap.put("num",chatGoodsMap.get("num"));
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(chatMap, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, httpEntity, String.class);
System.out.println("response=========="+response);
restTemplate带Headers远程调用接口
于 2023-09-27 11:23:18 首次发布