Content-type为application/json的post请求方式,服务端的处理方式

1、可以用流来处理

 //request.getParameterNames();
 br = new BufferedReader(new InputStreamReader((ServletInputStream) request.getInputStream(), "utf-8"));
 StringBuffer sb = new StringBuffer("");
 String temp;
 while ((temp = br.readLine()) != null) {
     sb.append(temp);
 }
 br.close();
 System.out.println("currentTimeMillis-->>"+sb.toString());

2、可以用注解方式

public String  userCount(@RequestBody  User user) 

你可能感兴趣的:(springboot)