post方式传递map参数,若是咱们经过post方式传递map参数或者是entity实体类的话,默认接收方的参数类型为application/json,也就是说你必须在你的接收方的参数中加上@requestBody注解,不然将会没法接收到参数;json
发送方:
Map<String,Object> params = new HashMap<String,Object>();
params.put("name","lishimin");
Map<String, Object> result = restTemplate.postForObject("url",params,Map.class);app
接收方:
public Map<String, Object> postTest(@RequestBody Map<String, Object> params){
}post