引入依赖
这里没有给出以后补
代码
//设置请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
//请求实体类 json封装
HttpEntity putBodyJson = new HttpEntity(bodyJson,headers);
/**发送PUT请求 测试本地接口 需要注释掉 59~61行,69行
* restTemplate.exchange("http://127.0.0.1:7001/user/test-http-put", HttpMethod.PUT, putBodyJson, String.class);
*/
ResponseEntity<String> responseEntity = restTemplate.exchange(klunStepInfo.getCommand(), HttpMethod.PUT, putBodyJson, String.class);
//获取服务器返回的内容
strReturn = responseEntity.getBody();