Spring RestTemplate 访问 restFul 接口

来源:互联网 发布:软件销售工程师 编辑:程序博客网 时间:2024/04/29 06:01

 Get:

RestTemplate restTemplate = new RestTemplate();        Map<String, String> urlVariables = new HashMap<String, String>();        urlVariables.put("userId","171348179");        ResponseFormat responseFormat =                restTemplate.getForObject("http://act.dianping.com/customized/wallet517?userId={userId}",ResponseFormat.class,urlVariables);

Post:

差不多