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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.createInvocableHandlerMethod
(Object bean, Method method) Create theInvocableHandlerMethod
that is able to process the specified method endpoint.protected List<HandlerMethodArgumentResolver>
void
setArgumentResolvers
(List<HandlerMethodArgumentResolver> argumentResolvers) Configure the complete list of supported argument types effectively overriding the ones configured by default.void
setBeanFactory
(BeanFactory beanFactory) ABeanFactory
only needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.void
setConversionService
(ConversionService conversionService) Set theConversionService
to use to convert the original message payload or headers.void
setCustomArgumentResolvers
(List<HandlerMethodArgumentResolver> customArgumentResolvers) Set the list of customHandlerMethodArgumentResolver
s that will be used after resolvers for supported argument type.void
setMessageConverter
(MessageConverter messageConverter) Set theMessageConverter
to use.void
setValidator
(Validator validator) Set the Validator instance used for validating@Payload
arguments.
-
Constructor Details
-
DefaultMessageHandlerMethodFactory
public DefaultMessageHandlerMethodFactory()
-
-
Method Details
-
setConversionService
Set theConversionService
to use to convert the original message payload or headers. -
setMessageConverter
Set theMessageConverter
to use. By default aGenericMessageConverter
is used.- See Also:
-
setValidator
Set the Validator instance used for validating@Payload
arguments.- See Also:
-
setCustomArgumentResolvers
Set the list of customHandlerMethodArgumentResolver
s 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
ABeanFactory
only needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.- Specified by:
setBeanFactory
in 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:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.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:
afterPropertiesSet
in interfaceInitializingBean
-
createInvocableHandlerMethod
Description copied from interface:MessageHandlerMethodFactory
Create theInvocableHandlerMethod
that is able to process the specified method endpoint.- Specified by:
createInvocableHandlerMethod
in interfaceMessageHandlerMethodFactory
- Parameters:
bean
- the bean instancemethod
- the method to invoke- Returns:
- an
InvocableHandlerMethod
suitable for that method
-
initArgumentResolvers
-