跨服务器发送请求

@Autowired
private RestTemplate restTemplate;

发送post请求
ResultBase resultBase = restTemplate.postForObject(“http://userService/user/go”, map, ResultBase.class);//第一个为发送的地址,map是Map类型,第三个参数是设置返回类型

然后就可接收到
@PostMapping("/user/go")
public ResultBase haha(String companyId, String provinceId, String cityId, String districtId) {
return new ResultBase();
}

猜你喜欢

转载自blog.csdn.net/chaogaoxiaojifantong/article/details/89056775