注释类型 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 anHttpMessageConverter
to 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.
- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma
- 另请参阅:
RequestHeader
,ResponseBody
,RequestMappingHandlerAdapter
可选元素概要
可选元素 修饰符和类型 可选元素 说明 boolean
required
Whether body content is required.
元素详细资料
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 tofalse
if you prefernull
to be passed when the body content isnull
.- 从以下版本开始:
- 3.2
- 默认值:
- true