一、介绍
@RequestBody用于获取请求体中的数据,其属性required默认为true。
二、项目测试
(1)编写Controller类
@Controller
public class MyController {
@RequestMapping(value = {"/hello"})
public String hello(@RequestBody String body, String username, String password){
System.out.println(body);
System.out.println(username + password);
return "hello";
}
}
(2)运行