Class PayloadMethodArgumentResolver
java.lang.Object
org.springframework.messaging.handler.annotation.reactive.PayloadMethodArgumentResolver
- All Implemented Interfaces:
- HandlerMethodArgumentResolver
A resolver to extract and decode the payload of a message using a
 
Decoder, where the payload is expected to be a Publisher of
 DataBuffer.
 Validation is applied if the method argument is annotated with
 @jakarta.validation.Valid or
 Validated. Validation
 failure results in an MethodArgumentNotValidException.
 
This resolver should be ordered last if useDefaultResolution is
 set to true since in that case it supports all types and does not
 require the presence of Payload.
- Since:
- 5.2
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionPayloadMethodArgumentResolver(List<? extends Decoder<?>> decoders, Validator validator, ReactiveAdapterRegistry registry, boolean useDefaultResolution) 
- 
Method SummaryModifier and TypeMethodDescriptionReturn the configuredReactiveAdapterRegistry.Return a read-only list of the configured decoders.protected MimeTypegetMimeType(Message<?> message) Return the mime type for the content.Return the configured validator, if any.booleanWhether this resolver is configured to use default resolution, i.e.final reactor.core.publisher.Mono<Object>resolveArgument(MethodParameter parameter, Message<?> message) Decode the content of the given message payload through a compatibleDecoder.booleansupportsParameter(MethodParameter parameter) Whether the given method parameter is supported by this resolver.
- 
Field Details- 
logger
 
- 
- 
Constructor Details- 
PayloadMethodArgumentResolver
 
- 
- 
Method Details- 
getDecodersReturn a read-only list of the configured decoders.
- 
getValidatorReturn the configured validator, if any.
- 
getAdapterRegistryReturn the configuredReactiveAdapterRegistry.
- 
isUseDefaultResolutionpublic boolean isUseDefaultResolution()Whether this resolver is configured to use default resolution, i.e. works for any argument type regardless of whether@Payloadis present or not.
- 
supportsParameterDescription copied from interface:HandlerMethodArgumentResolverWhether the given method parameter is supported by this resolver.- Specified by:
- supportsParameterin interface- HandlerMethodArgumentResolver
- Parameters:
- parameter- the method parameter to check
- Returns:
- trueif this resolver supports the supplied parameter;- falseotherwise
 
- 
resolveArgumentpublic final reactor.core.publisher.Mono<Object> resolveArgument(MethodParameter parameter, Message<?> message) Decode the content of the given message payload through a compatibleDecoder.Validation is applied if the method argument is annotated with @jakarta.validation.ValidorValidated. Validation failure results in anMethodArgumentNotValidException.- Specified by:
- resolveArgumentin interface- HandlerMethodArgumentResolver
- Parameters:
- parameter- the target method argument that we are decoding to
- message- the message from which the content was extracted
- Returns:
- a Mono with the result of argument resolution
- See Also:
- 
- extractContent(MethodParameter, Message)
- getMimeType(Message)
 
 
- 
getMimeTypeReturn the mime type for the content. By default this method checks theMessageHeaders.CONTENT_TYPEheader expecting to find aMimeTypevalue or a String to parse to aMimeType.- Parameters:
- message- the input message
 
 
-