Springboot使用RestTemplate发送Post请求postForEntity (application/json)

String param = '[1424,2255]';
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> request = new HttpEntity<String>(param, headers);
ResponseEntity<String> str  = restTemplate.postForEntity(url,request,String.class);
log.debug("End request interface, the response is {}",str);
String json = str.getBody();
原文地址:https://www.cnblogs.com/xiaolaodi1999/p/14237251.html