spring-framework / org.springframework.messaging.handler.annotation.support

Package org.springframework.messaging.handler.annotation.support

Types

AbstractNamedValueMethodArgumentResolver

abstract class AbstractNamedValueMethodArgumentResolver : HandlerMethodArgumentResolver

Abstract base class for resolving method arguments from a named value. Message headers, and path variables are examples of named values. Each may have a name, a required flag, and a default value.

Subclasses define how to do the following:

  • Obtain named value information for a method parameter
  • Resolve names into argument values
  • Handle missing argument values when argument values are required
  • Optionally handle a resolved value

A default value string can contain ${...} placeholders and Spring Expression Language #{...} expressions. For this to work a ConfigurableBeanFactory must be supplied to the class constructor.

A ConversionService may be used to apply type conversion to the resolved argument value if it doesn't match the method parameter type.

AnnotationExceptionHandlerMethodResolver

open class AnnotationExceptionHandlerMethodResolver : AbstractExceptionHandlerMethodResolver

A sub-class of AbstractExceptionHandlerMethodResolver that looks for MessageExceptionHandler-annotated methods in a given class. The actual exception types handled are extracted either from the annotation, if present, or from the method signature as a fallback option.

DestinationVariableMethodArgumentResolver

open class DestinationVariableMethodArgumentResolver : AbstractNamedValueMethodArgumentResolver

Resolves method parameters annotated with org.springframework.messaging.handler.annotation.DestinationVariable.

HeaderMethodArgumentResolver

open class HeaderMethodArgumentResolver : AbstractNamedValueMethodArgumentResolver

Resolves method parameters annotated with Header.

HeadersMethodArgumentResolver

open class HeadersMethodArgumentResolver : HandlerMethodArgumentResolver

Resolves the following method parameters:

  • Parameters assignable to Map annotated with Headers
  • Parameters of type MessageHeaders
  • Parameters assignable to MessageHeaderAccessor

MessageMethodArgumentResolver

open class MessageMethodArgumentResolver : HandlerMethodArgumentResolver

HandlerMethodArgumentResolver for Message method arguments. Validates that the generic type of the payload matches to the message value or otherwise applies MessageConverter to convert to the expected payload type.

PayloadArgumentResolver

open class PayloadArgumentResolver : HandlerMethodArgumentResolver

A resolver to extract and convert the payload of a message using a MessageConverter. It also validates the payload using a Validator if the argument is annotated with a Validation annotation.

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

Exceptions

MethodArgumentNotValidException

open class MethodArgumentNotValidException : MethodArgumentResolutionException

Exception to be thrown when a method argument fails validation perhaps as a result of @Valid style validation, or perhaps because it is required.

MethodArgumentTypeMismatchException

open class MethodArgumentTypeMismatchException : MethodArgumentResolutionException

Exception that indicates that a method argument has not the expected type.