Class PayloadMethodArgumentResolver

java.lang.Object
org.springframework.messaging.handler.annotation.support.PayloadMethodArgumentResolver
All Implemented Interfaces:
HandlerMethodArgumentResolver

public class PayloadMethodArgumentResolver extends Object implements HandlerMethodArgumentResolver
A resolver to extract and convert the payload of a message using a MessageConverter.

Validation is applied if the method argument is annotated with Validated or @jakarta.validation.Valid. Validation failure results in an MethodArgumentNotValidException.

This HandlerMethodArgumentResolver should be ordered last as it supports all types and does not require the Payload annotation.

Since:
5.2
Author:
Rossen Stoyanchev, Juergen Hoeller, Brian Clozel, Stephane Nicoll
  • Constructor Details

    • PayloadMethodArgumentResolver

      public PayloadMethodArgumentResolver(MessageConverter messageConverter)
      Create a new PayloadArgumentResolver with the given MessageConverter.
      Parameters:
      messageConverter - the MessageConverter to use (required)
    • PayloadMethodArgumentResolver

      public PayloadMethodArgumentResolver(MessageConverter messageConverter, @Nullable Validator validator)
      Create a new PayloadArgumentResolver with the given MessageConverter and Validator.
      Parameters:
      messageConverter - the MessageConverter to use (required)
      validator - the Validator to use (optional)
    • PayloadMethodArgumentResolver

      public PayloadMethodArgumentResolver(MessageConverter messageConverter, @Nullable Validator validator, boolean useDefaultResolution)
      Create a new PayloadArgumentResolver with the given MessageConverter and Validator.
      Parameters:
      messageConverter - the MessageConverter to use (required)
      validator - the Validator to use (optional)
      useDefaultResolution - if "true" (the default) this resolver supports all parameters; if "false" then only arguments with the @Payload annotation are supported.
  • Method Details