public class DefaultMessageHandlerMethodFactory extends Object implements MessageHandlerMethodFactory, BeanFactoryAware, InitializingBean
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
setConversionService(org.springframework.core.convert.ConversionService)
,
setValidator(org.springframework.validation.Validator)
,
setCustomArgumentResolvers(java.util.List<org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver>)
Constructor and Description |
---|
DefaultMessageHandlerMethodFactory() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware , ApplicationContextAware etc. |
InvocableHandlerMethod |
createInvocableHandlerMethod(Object bean,
Method method)
Create the
InvocableHandlerMethod that is able to process the specified
method endpoint. |
protected List<HandlerMethodArgumentResolver> |
initArgumentResolvers() |
void |
setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Configure the complete list of supported argument types effectively overriding
the ones configured by default.
|
void |
setBeanFactory(BeanFactory beanFactory)
A
BeanFactory only needs to be available for placeholder resolution
in handler method arguments; it's optional otherwise. |
void |
setConversionService(ConversionService conversionService)
Set the
ConversionService to use to convert the original
message payload or headers. |
void |
setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> customArgumentResolvers)
Set the list of custom
HandlerMethodArgumentResolver s that will be used
after resolvers for supported argument type. |
void |
setMessageConverter(MessageConverter messageConverter)
Set the
MessageConverter to use. |
void |
setValidator(Validator validator)
Set the Validator instance used for validating
@Payload arguments. |
public void setConversionService(ConversionService conversionService)
ConversionService
to use to convert the original
message payload or headers.public void setMessageConverter(MessageConverter messageConverter)
MessageConverter
to use. By default a GenericMessageConverter
is used.GenericMessageConverter
public void setValidator(Validator validator)
@Payload
arguments.Validated
,
PayloadMethodArgumentResolver
public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> customArgumentResolvers)
HandlerMethodArgumentResolver
s that will be used
after resolvers for supported argument type.customArgumentResolvers
- the list of resolvers (never null
)public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
setCustomArgumentResolvers(java.util.List)
.public void setBeanFactory(BeanFactory beanFactory)
BeanFactory
only needs to be available for placeholder resolution
in handler method arguments; it's optional otherwise.setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.BeanInitializationException
public void afterPropertiesSet()
InitializingBean
BeanFactory
after it has set all bean properties
and satisfied BeanFactoryAware
, 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.
afterPropertiesSet
in interface InitializingBean
public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method)
MessageHandlerMethodFactory
InvocableHandlerMethod
that is able to process the specified
method endpoint.createInvocableHandlerMethod
in interface MessageHandlerMethodFactory
bean
- the bean instancemethod
- the method to invokeInvocableHandlerMethod
suitable for that methodprotected List<HandlerMethodArgumentResolver> initArgumentResolvers()