spring-framework / org.springframework.messaging.handler.invocation / AbstractMethodMessageHandler

AbstractMethodMessageHandler

abstract class AbstractMethodMessageHandler<T : Any> : MessageHandler, ApplicationContextAware, InitializingBean

Abstract base class for HandlerMethod-based message handling. Provides most of the logic required to discover handler methods at startup, find a matching handler method at runtime for a given message and invoke it.

Also supports discovering and invoking exception handling methods to process exceptions raised during message handling.

Parameters

- the type of the Object that contains information mapping a org.springframework.messaging.handler.HandlerMethod to incoming messages

Author
Rossen Stoyanchev

Author
Juergen Hoeller

Since
4.0

Constructors

<init>

AbstractMethodMessageHandler()

Abstract base class for HandlerMethod-based message handling. Provides most of the logic required to discover handler methods at startup, find a matching handler method at runtime for a given message and invoke it.

Also supports discovering and invoking exception handling methods to process exceptions raised during message handling.

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

getApplicationContext

open fun getApplicationContext(): ApplicationContext

getArgumentResolvers

open fun getArgumentResolvers(): MutableList<HandlerMethodArgumentResolver>

Return the complete list of argument resolvers.

getCustomArgumentResolvers

open fun getCustomArgumentResolvers(): MutableList<HandlerMethodArgumentResolver>

Return the configured custom argument resolvers, if any.

getCustomReturnValueHandlers

open fun getCustomReturnValueHandlers(): MutableList<HandlerMethodReturnValueHandler>

Return the configured custom return value handlers, if any.

getDestinationPrefixes

open fun getDestinationPrefixes(): MutableCollection<String>

Return the configured destination prefixes, if any.

getHandlerMethods

open fun getHandlerMethods(): MutableMap<T, HandlerMethod>

Return a map with all handler methods and their mappings.

getReturnValueHandlers

open fun getReturnValueHandlers(): MutableList<HandlerMethodReturnValueHandler>

Return the complete list of return value handlers.

handleMessage

open fun handleMessage(message: Message<*>): Unit

setApplicationContext

open fun setApplicationContext(applicationContext: ApplicationContext): Unit

setArgumentResolvers

open fun setArgumentResolvers(argumentResolvers: MutableList<HandlerMethodArgumentResolver>): Unit

Configure the complete list of supported argument types, effectively overriding the ones configured by default. This is an advanced option; for most use cases it should be sufficient to use #setCustomArgumentResolvers.

setCustomArgumentResolvers

open fun setCustomArgumentResolvers(customArgumentResolvers: MutableList<HandlerMethodArgumentResolver>): Unit

Sets the list of custom HandlerMethodArgumentResolvers that will be used after resolvers for supported argument type.

setCustomReturnValueHandlers

open fun setCustomReturnValueHandlers(customReturnValueHandlers: MutableList<HandlerMethodReturnValueHandler>): Unit

Set the list of custom HandlerMethodReturnValueHandlers that will be used after return value handlers for known types.

setDestinationPrefixes

open fun setDestinationPrefixes(prefixes: MutableCollection<String>): Unit

When this property is configured only messages to destinations matching one of the configured prefixes are eligible for handling. When there is a match the prefix is removed and only the remaining part of the destination is used for method-mapping purposes.

By default, no prefixes are configured in which case all messages are eligible for handling.

setReturnValueHandlers

open fun setReturnValueHandlers(returnValueHandlers: MutableList<HandlerMethodReturnValueHandler>): Unit

Configure the complete list of supported return value types, effectively overriding the ones configured by default. This is an advanced option; for most use cases it should be sufficient to use #setCustomReturnValueHandlers.

toString

open fun toString(): String