Class IntegrationObjectSupport

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, InitializingBean, ApplicationContextAware, ExpressionCapable, NamedComponent
Direct Known Subclasses:
AbstractConnectionFactory, AbstractEndpoint, AbstractHandleMessageAdvice, AbstractMailReceiver, AbstractMessageChannel, AbstractRequestHandlerAdvice, AbstractTransformer, CodecMessageConverter, DefaultHeaderChannelRegistry, ExpressionEvaluatingTransactionSynchronizationProcessor, HeaderEnricher, HeaderFilter, MessageHandlerSupport

public abstract class IntegrationObjectSupport extends Object implements BeanNameAware, NamedComponent, ApplicationContextAware, BeanFactoryAware, InitializingBean, ExpressionCapable
A base class that provides convenient access to the bean factory as well as TaskScheduler and ConversionService instances.

This is intended to be used as a base class for internal framework components whereas code built upon the integration framework should not require tight coupling with the context but rather rely on standard dependency injection.

Mark Fisher, Oleg Zhurakousky, Josh Long, Stefan Ferstl, Gary Russell, Artem Bilan
  • Field Details

  • Constructor Details

    • IntegrationObjectSupport

      public IntegrationObjectSupport()
  • Method Details

    • setBeanName

      public final void setBeanName(@Nullable String beanName)
      Specified by:
      setBeanName in interface BeanNameAware
    • getBeanName

      public String getBeanName()
      Specified by:
      getBeanName in interface NamedComponent
    • getComponentName

      public String getComponentName()
      Will return the name of this component identified by componentName field. If componentName was not set this method will default to the 'beanName' of this component;
      Specified by:
      getComponentName in interface NamedComponent
    • setComponentName

      public void setComponentName(String componentName)
      Sets the name of this component.
      componentName - The component name.
    • getComponentType

      public String getComponentType()
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
    • getBeanDescription

      public String getBeanDescription()
    • setBeanFactory

      public void setBeanFactory(BeanFactory beanFactory)
      Specified by:
      setBeanFactory in interface BeanFactoryAware
    • setApplicationContext

      public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
      Specified by:
      setApplicationContext in interface ApplicationContextAware
    • setChannelResolver

      public void setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
      Specify the DestinationResolver strategy to use. The default is a BeanFactoryChannelResolver.
      channelResolver - The channel resolver.
    • getExpression

      public Expression getExpression()
      Description copied from interface: ExpressionCapable
      Return the primary SpEL expression if this component is expression-based.
      Specified by:
      getExpression in interface ExpressionCapable
      the expression as a String.
    • setPrimaryExpression

      public final void setPrimaryExpression(Expression expression)
      For expression-based components, set the primary expression.
      expression - the expression.
    • afterPropertiesSet

      public final void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface InitializingBean
    • onInit

      protected void onInit()
      Subclasses may implement this for initialization logic.
    • isInitialized

      protected boolean isInitialized()
      Return the status of this component if it has been initialized already.
      the flag if this component has been initialized already.
    • getBeanFactory

      protected BeanFactory getBeanFactory()
    • setTaskScheduler

      public void setTaskScheduler(TaskScheduler taskScheduler)
      Configure a TaskScheduler for those components which logic relies on the scheduled tasks. If not provided, falls back to the global taskScheduler bean in the application context, provided by the Spring Integration infrastructure.
      taskScheduler - the TaskScheduler to use.
      See Also:
    • getTaskScheduler

      protected TaskScheduler getTaskScheduler()
    • getChannelResolver

      protected DestinationResolver<MessageChannel> getChannelResolver()
    • getConversionService

      public ConversionService getConversionService()
    • setConversionService

      public void setConversionService(ConversionService conversionService)
    • getApplicationContextId

      public String getApplicationContextId()
      Returns the ApplicationContext.getId() if the ApplicationContext is available.
      The id, or null if there is no application context.
    • getApplicationContext

      protected ApplicationContext getApplicationContext()
      the applicationContext
    • getIntegrationProperties

      protected IntegrationProperties getIntegrationProperties()
      The global integration properties.
      See Also:
    • getMessageBuilderFactory

      protected MessageBuilderFactory getMessageBuilderFactory()
    • setMessageBuilderFactory

      public void setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory)
    • getIntegrationProperty

      @Deprecated(since="6.0") protected <T> T getIntegrationProperty(String key, Class<T> tClass)
      Type Parameters:
      T - The expected type of the property.
      key - Integration property.
      tClass - the class to convert a value of Integration property.
      the value of the Integration property converted to the provide type.
    • toString

      public String toString()
      toString in class Object
    • extractTypeIfPossible

      @Nullable public static <T> T extractTypeIfPossible(@Nullable Object targetObject, Class<T> expectedType)
    • generateId

      public static UUID generateId()