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 Details

    • DefaultMessageHandlerMethodFactory

      public DefaultMessageHandlerMethodFactory()
  • Method Details

    • setConversionService

      public void setConversionService(org.springframework.core.convert.ConversionService conversionService)
      Set the ConversionService to use to convert the original message payload or headers.
      See Also:
    • setMessageConverter

      public void setMessageConverter(MessageConverter messageConverter)
      Set the MessageConverter to use. By default a GenericMessageConverter is used.
      See Also:
    • setValidator

      public void setValidator(org.springframework.validation.Validator validator)
      Set the Validator instance used for validating @Payload arguments.
      See Also:
    • setCustomArgumentResolvers

      public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> customArgumentResolvers)
      Set the list of custom HandlerMethodArgumentResolvers that will be used after resolvers for supported argument type.
      Parameters:
      customArgumentResolvers - the list of resolvers (never null)
    • setArgumentResolvers

      public void setArgumentResolvers(@Nullable 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 use setCustomArgumentResolvers(java.util.List).
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
      A BeanFactory only needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • createInvocableHandlerMethod

      public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method)
      Description copied from interface: MessageHandlerMethodFactory
      Create the InvocableHandlerMethod that is able to process the specified method endpoint.
      Specified by:
      createInvocableHandlerMethod in interface MessageHandlerMethodFactory
      Parameters:
      bean - the bean instance
      method - the method to invoke
      Returns:
      an InvocableHandlerMethod suitable for that method
    • initArgumentResolvers

      protected List<HandlerMethodArgumentResolver> initArgumentResolvers()