请求:
1 curl -X POST "http://localhost:8080/hello2" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"username\": \"test\"}"
接口:
1 @PostMapping("/hello2") 2 public String hello2(@RequestBody Map<String,String> data){ 3 System.out.println(data.getClass()); 4 return "hello "+data.get("username"); 5 }