spring boot Required request parameter ‘xxx‘ for method parameter type xxx is not present
程序员文章站
2022-03-08 16:13:16
...
前端请求方式不同,后端处理方式不同
content-Type为 application/x-www-form-urlencoded
后端处理方式为
@PostMapping("register")
public R insertUser(User user){
return R.ok().data("data",UserService.save(user));
}
content-type 为application/json,返回结果为user对象的json字符串,为String类型,需要使用fastJson进行处理再插入数据。
推荐阅读
-
Spring请求问题之MissingServletRequestParameterException: Required xxx parameter ‘xxx’ is not present
-
400 Bad Request(Required String parameter ‘xxx‘ is not present)
-
Spring Boot解决Required String parameter xxx is not present类型异常
-
spring boot Required request parameter ‘xxx‘ for method parameter type xxx is not present