Class DefaultMessageHandlerMethodFactory
java.lang.Object
org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory
- All Implemented Interfaces:
Aware,BeanFactoryAware,InitializingBean,MessageHandlerMethodFactory
public class DefaultMessageHandlerMethodFactory
extends Object
implements MessageHandlerMethodFactory, BeanFactoryAware, 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 TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.createInvocableHandlerMethod(Object bean, Method method) Create theInvocableHandlerMethodthat is able to process the specified method endpoint.protected List<HandlerMethodArgumentResolver>voidsetArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) Configure the complete list of supported argument types effectively overriding the ones configured by default.voidsetBeanFactory(BeanFactory beanFactory) ABeanFactoryonly needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.voidsetConversionService(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(Validator validator) Set the Validator instance used for validating@Payloadarguments.
-
Constructor Details
-
DefaultMessageHandlerMethodFactory
public DefaultMessageHandlerMethodFactory()
-
-
Method Details
-
setConversionService
Set theConversionServiceto use to convert the original message payload or headers. -
setMessageConverter
Set theMessageConverterto use. By default aGenericMessageConverteris used.- See Also:
-
setValidator
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
ABeanFactoryonly needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Parameters:
beanFactory- owning BeanFactory (nevernull). The bean can immediately call methods on the factory.- See Also:
-
afterPropertiesSet
public void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
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
-