HTTP Status 400 - Required String parameter 'username' is not present

postman里的报错

HTTP Status 400 - Required String parameter 'username' is not present_第1张图片

@RequestParam()用法:

绑定前端提交的参数,追进去看看源码:

* Annotation which indicates that a method parameter should be bound to a web
* request parameter. Supported for annotated handler methods in Servlet and
* Portlet environments.

这段英文的意思是这个注解表明需要方法参数绑定在web请求中,支持servlet中带注释的处理方法

HTTP Status 400 - Required String parameter 'username' is not present_第2张图片

所以,注解中加入required=false

@RequestParam(value = "username", required = false) 

你可能感兴趣的:(Java)