类 DefaultMessageHandlerMethodFactory
- java.lang.Object
- org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory
public class DefaultMessageHandlerMethodFactory extends Object implements MessageHandlerMethodFactory, BeanFactoryAware, InitializingBean
The defaultMessageHandlerMethodFactory
implementation creating anInvocableHandlerMethod
with the necessaryHandlerMethodArgumentResolver
instances to detect and process most of the use cases defined byMessageMapping
.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. TheConversionService
can be customized in a similar manner to tune how the message payload can be converted- 从以下版本开始:
- 4.1
- 作者:
- Stephane Nicoll, Juergen Hoeller
- 另请参阅:
setConversionService(org.springframework.core.convert.ConversionService)
,setValidator(org.springframework.validation.Validator)
,setCustomArgumentResolvers(java.util.List<org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver>)
构造器概要
构造器 构造器 说明 DefaultMessageHandlerMethodFactory()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.InvocableHandlerMethod
createInvocableHandlerMethod(Object bean, Method method)
Create theInvocableHandlerMethod
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)
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
构造器详细资料
DefaultMessageHandlerMethodFactory
public DefaultMessageHandlerMethodFactory()
方法详细资料
setConversionService
public void setConversionService(ConversionService conversionService)
Set theConversionService
to use to convert the original message payload or headers.
setMessageConverter
public void setMessageConverter(MessageConverter messageConverter)
Set theMessageConverter
to use. By default aGenericMessageConverter
is used.
setValidator
public void setValidator(Validator validator)
Set the Validator instance used for validating @Payload arguments
setCustomArgumentResolvers
public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> customArgumentResolvers)
Set the list of customHandlerMethodArgumentResolver
s that will be used after resolvers for supported argument type.- 参数:
customArgumentResolvers
- the list of resolvers (nevernull
)
setArgumentResolvers
public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
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(BeanFactory beanFactory)
ABeanFactory
only needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.- 指定者:
setBeanFactory
在接口中BeanFactoryAware
- 参数:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- 另请参阅:
BeanInitializationException
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明: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.
- 指定者:
afterPropertiesSet
在接口中InitializingBean
createInvocableHandlerMethod
public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method)
从接口复制的说明:MessageHandlerMethodFactory
Create theInvocableHandlerMethod
that is able to process the specified method endpoint.- 指定者:
createInvocableHandlerMethod
在接口中MessageHandlerMethodFactory
- 参数:
bean
- the bean instancemethod
- the method to invoke- 返回:
- an
InvocableHandlerMethod
suitable for that method
initArgumentResolvers
protected List<HandlerMethodArgumentResolver> initArgumentResolvers()