请求
Map<String, Object> param = new HashMap<>();
//Map可以是其他类型的数据结构
Map result = restTemplate.exchange(
path,
HttpMethod.POST,
new HttpEntity<>(param, null),
new ParameterizedTypeReference<Map>() {
},
JSON.toJSONString(param)
).getBody();
接受
@PostMapping(value = "sendMessage")
public Map<String,Object> sendMessage(@RequestBody Map<String,Object> param){
Map<String,Object> result =new HashMap<>();
// 操作
return result;
}