org.springframework.messaging.handler.annotation.support

## 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:
  `setConversionService(org.springframework.core.convert.ConversionService)`, `setValidator(org.springframework.validation.Validator)`, `setCustomArgumentResolvers(java.util.List<org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver>)`

### Constructor Summary

Constructors
Constructor and Description
`DefaultMessageHandlerMethodFactory()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `afterPropertiesSet()`
`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(org.springframework.beans.factory.BeanFactory beanFactory)` A `BeanFactory` only needs to be available for placeholder resolution in handler method arguments; it's optional otherwise.
`void` `setConversionService(org.springframework.core.convert.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(org.springframework.validation.Validator validator)` Set the Validator instance used for validating `@Payload` arguments.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DefaultMessageHandlerMethodFactory

    public DefaultMessageHandlerMethodFactory()

### Method Detail

#### 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:
  `HeaderMethodArgumentResolver`, `GenericMessageConverter`

#### setMessageConverter

    public void setMessageConverter(MessageConverter messageConverter)

Set the `MessageConverter` to use. By default a `GenericMessageConverter` is used.

See Also:
  `GenericMessageConverter`

#### setValidator

    public void setValidator(org.springframework.validation.Validator validator)

Set the Validator instance used for validating `@Payload` arguments.

See Also:
  `Validated`, `PayloadMethodArgumentResolver`

#### setCustomArgumentResolvers

    public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> customArgumentResolvers)

Set the list of custom `HandlerMethodArgumentResolver`s that will be used after resolvers for supported argument type.

Parameters:
  `customArgumentResolvers` - the list of resolvers (never `null`)

#### 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 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()