Class DefaultMessageHandlerMethodFactory
java.lang.Object
org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.InitializingBean,MessageHandlerMethodFactory
public class DefaultMessageHandlerMethodFactory
extends Object
implements MessageHandlerMethodFactory, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean
The default
MessageHandlerMethodFactory implementation creating an
InvocableHandlerMethod with the necessary
HandlerMethodArgumentResolver instances to detect and process
most of the use cases defined by
MessageMapping.
Extra method argument resolvers can be added to customize the method signature that can be handled.
By default, the validation process redirects to a no-op implementation, see
setValidator(Validator) to customize it. The ConversionService
can be customized in a similar manner to tune how the message payload
can be converted
- Since:
- 4.1
- Author:
- Stephane Nicoll, Juergen Hoeller
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateInvocableHandlerMethod(Object bean, Method method) Create theInvocableHandlerMethodthat is able to process the specified method endpoint.protected List<HandlerMethodArgumentResolver> voidsetArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) Configure the complete list of supported argument types effectively overriding the ones configured by default.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) ABeanFactoryonly needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.voidsetConversionService(org.springframework.core.convert.ConversionService conversionService) Set theConversionServiceto use to convert the original message payload or headers.voidsetCustomArgumentResolvers(List<HandlerMethodArgumentResolver> customArgumentResolvers) Set the list of customHandlerMethodArgumentResolvers that will be used after resolvers for supported argument type.voidsetMessageConverter(MessageConverter messageConverter) Set theMessageConverterto use.voidsetValidator(org.springframework.validation.Validator validator) Set the Validator instance used for validating@Payloadarguments.
-
Constructor Details
-
DefaultMessageHandlerMethodFactory
public DefaultMessageHandlerMethodFactory()
-
-
Method Details
-
setConversionService
public void setConversionService(org.springframework.core.convert.ConversionService conversionService) Set theConversionServiceto use to convert the original message payload or headers.- See Also:
-
setMessageConverter
Set theMessageConverterto use. By default aGenericMessageConverteris used.- See Also:
-
setValidator
public void setValidator(org.springframework.validation.Validator validator) Set the Validator instance used for validating@Payloadarguments.- See Also:
-
setCustomArgumentResolvers
Set the list of customHandlerMethodArgumentResolvers that will be used after resolvers for supported argument type.- Parameters:
customArgumentResolvers- the list of resolvers (nevernull)
-
setArgumentResolvers
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 usesetCustomArgumentResolvers(java.util.List). -
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) ABeanFactoryonly needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
createInvocableHandlerMethod
Description copied from interface:MessageHandlerMethodFactoryCreate theInvocableHandlerMethodthat is able to process the specified method endpoint.- Specified by:
createInvocableHandlerMethodin interfaceMessageHandlerMethodFactory- Parameters:
bean- the bean instancemethod- the method to invoke- Returns:
- an
InvocableHandlerMethodsuitable for that method
-
initArgumentResolvers
-