Annotation Type RequestBody
@Target(PARAMETER) @Retention(RUNTIME) @Documented public @interface RequestBody
Annotation indicating a method parameter should be bound to the body of the web request. The body of the request is passed through anHttpMessageConverterto resolve the method argument depending on the content type of the request. Optionally, automatic validation can be applied by annotating the argument with@Valid.Supported for annotated handler methods in Servlet environments.
- Since:
- 3.0
- Author:
- Arjen Poutsma
- See Also:
RequestHeader,ResponseBody,RequestMappingHandlerAdapter
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanrequiredWhether body content is required.
Element Detail
required
boolean required
Whether body content is required.Default is
true, leading to an exception thrown in case there is no body content. Switch this tofalseif you prefernullto be passed when the body content isnull.- Since:
- 3.2
- Default:
- true