@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";
}