以spring Boot 为例 :
发送端1.引入jar包,pom.xml
commons-httpclient commons-httpclient3.1
2.controller层直接调用即可
@GetMapping("sendPost")
public String sendPost(){
HttpClient client = new HttpClient(); //创建Client
PostMethod method=null;
String result="";
try {
method = new PostMethod("换成你自己的路径");
method.setParameter("id", "{id:12131}");// 设置参数
client.executeMethod(method);
if (method.getStatusCode() == HttpStatus.SC_OK) {// 响应成功
result = method.getResponseBodyAsString();// 调用返回结果
return result;
} else {// 不成功组装结果
return "error";
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
* 接收端*
@RequestMapping(value = "/test",method = RequestMethod.POST)
@ResponseBody
public String test(String id){
System.out.println(id);
return "success";
}
亲测有效,工作记录



