赞
踩
- @GetMapping("/rest")
- public void rest(){
-
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
- HashMap <Object,Object>map=new HashMap();
- map.put("name","dasdad");
- //用HttpEntity封装整个请求报文
- HttpEntity<HashMap<String, Object>> request = new HttpEntity(map, headers);
- String re= restTemplate.postForObject("http://localhost:8083/s",request,String.class);
- // String forObject = restTemplate.getForObject("http://localhost:8083/sys/test2", String.class);
- System.out.println("response:"+re);
- }
-
- @PostMapping("/s")
- public String test(@RequestBody String name){
- System.out.println(name);
- return "vvvv";
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。