public class RequestBodyArgumentResolver extends AbstractMessageReaderArgumentResolver implements HandlerMethodArgumentResolver
@RequestBody
by reading the
body of the request through a compatible HttpMessageReader
.
An @RequestBody
method argument is also validated if it is
annotated with @javax.validation.Valid
or
Validated
. Validation
failure results in an ServerWebInputException
.
Constructor and Description |
---|
RequestBodyArgumentResolver(java.util.List<HttpMessageReader<?>> readers)
Constructor with
HttpMessageReader 's and a Validator . |
RequestBodyArgumentResolver(java.util.List<HttpMessageReader<?>> readers,
ReactiveAdapterRegistry registry)
Constructor that also accepts a
ReactiveAdapterRegistry . |
Modifier and Type | Method and Description |
---|---|
<any> |
resolveArgument(MethodParameter param,
BindingContext bindingContext,
ServerWebExchange exchange)
The returned
Mono may produce one or zero values if the argument
does not resolve to any value, which will result in null passed
as the argument value. |
boolean |
supportsParameter(MethodParameter parameter) |
checkRequired, extractValidationHints, getAdapterRegistry, getMessageReaders, getRequiredBodyError, readBody, validate, wrapReadError
public RequestBodyArgumentResolver(java.util.List<HttpMessageReader<?>> readers)
HttpMessageReader
's and a Validator
.readers
- readers for de-serializing the request body withpublic RequestBodyArgumentResolver(java.util.List<HttpMessageReader<?>> readers, ReactiveAdapterRegistry registry)
ReactiveAdapterRegistry
.readers
- readers for de-serializing the request body withregistry
- for adapting to other reactive types from Flux and Monopublic boolean supportsParameter(MethodParameter parameter)
supportsParameter
in interface HandlerMethodArgumentResolver
public <any> resolveArgument(MethodParameter param, BindingContext bindingContext, ServerWebExchange exchange)
HandlerMethodArgumentResolver
Mono
may produce one or zero values if the argument
does not resolve to any value, which will result in null
passed
as the argument value.resolveArgument
in interface HandlerMethodArgumentResolver
param
- the method parameterbindingContext
- the binding context to useexchange
- the current exchange