get For Entity 和 post For Entity 简单示例

RestTemplate restTemplate = new RestTemplate();
        Map<String, Object> param = new HashMap<>();
        param.put("param1", "参数1");
        param.put("param2", "参数2");
        JSONObject result = restTemplate.postForEntity(url,param,JSONObject.class).getBody();
RestTemplate restTemplate = new RestTemplate();
        Map<String, String> param = new HashMap<>();
        param.put("param1", "参数1");
        ResponseEntity<String> result = restTemplate.getForEntity(url+"param1={param1}",String.class, param);
        JSONObject json = JSONObject.parseObject(result.getBody());

方法示例中  三个参数 

         URI:请求路径

         类型.class : 代表返回值类型

         param :请求入参