Class IntegrationObjectSupport
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ComponentSourceAware
,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 ComponentSourceAware, 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.
- Author:
- Mark Fisher, Oleg Zhurakousky, Josh Long, Stefan Ferstl, Gary Russell, Artem Bilan
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final ExpressionParser
protected final LogAccessor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
static <T> T
extractTypeIfPossible
(Object targetObject, Class<T> expectedType) static UUID
protected ApplicationContext
Returns theApplicationContext.getId()
if theApplicationContext
is available.protected BeanFactory
Return the bean name populated by theBeanNameAware.setBeanName(String)
.protected DestinationResolver<MessageChannel>
Return a human-readable description of this bean.Will return the name of this component identified bycomponentName
field.Return the configuration sourceObject
for this bean (maybenull
).Subclasses may implement this method to provide component type information.Return the primary SpEL expression if this component is expression-based.protected IntegrationProperties
protected MessageBuilderFactory
protected TaskScheduler
protected boolean
Return the status of this component if it has been initialized already.protected void
onInit()
Subclasses may implement this for initialization logic.void
setApplicationContext
(ApplicationContext applicationContext) void
setBeanFactory
(BeanFactory beanFactory) final void
setBeanName
(String beanName) void
setChannelResolver
(DestinationResolver<MessageChannel> channelResolver) Specify theDestinationResolver
strategy to use.void
setComponentDescription
(String description) Set a human-readable description of this bean.void
setComponentName
(String componentName) Sets the name of this component.void
setComponentSource
(Object source) Set a configuration sourceObject
for this bean definition.void
setConversionService
(ConversionService conversionService) void
setMessageBuilderFactory
(MessageBuilderFactory messageBuilderFactory) final void
setPrimaryExpression
(Expression expression) For expression-based components, set the primary expression.void
setTaskScheduler
(TaskScheduler taskScheduler) Configure aTaskScheduler
for those components which logic relies on the scheduled tasks.toString()
-
Field Details
-
EXPRESSION_PARSER
-
logger
-
-
Constructor Details
-
IntegrationObjectSupport
public IntegrationObjectSupport()
-
-
Method Details
-
setBeanName
- Specified by:
setBeanName
in interfaceBeanNameAware
-
getBeanName
Description copied from interface:ComponentSourceAware
Return the bean name populated by theBeanNameAware.setBeanName(String)
.- Specified by:
getBeanName
in interfaceComponentSourceAware
- Specified by:
getBeanName
in interfaceNamedComponent
- Returns:
- the bean name.
-
getComponentName
Will return the name of this component identified bycomponentName
field. IfcomponentName
was not set this method will default to the 'beanName' of this component;- Specified by:
getComponentName
in interfaceNamedComponent
-
setComponentName
Sets the name of this component.- Parameters:
componentName
- The component name.
-
getComponentType
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
-
setComponentSource
Description copied from interface:ComponentSourceAware
Set a configuration sourceObject
for this bean definition. For normalBeanDefinition
this is supplied by application context automatically. Could be useful when bean is registered at runtime viaSingletonBeanRegistry.registerSingleton(String, Object)
- Specified by:
setComponentSource
in interfaceComponentSourceAware
- Parameters:
source
- the configuration source
-
getComponentSource
Description copied from interface:ComponentSourceAware
Return the configuration sourceObject
for this bean (maybenull
). Usually (if not set explicitly) aBeanMetadataElement.getSource()
.- Specified by:
getComponentSource
in interfaceComponentSourceAware
- Returns:
- the configuration source for the bean (if any).
-
setComponentDescription
Description copied from interface:ComponentSourceAware
Set a human-readable description of this bean. For normal bean definition aBeanDefinition.getDescription()
is used.- Specified by:
setComponentDescription
in interfaceComponentSourceAware
- Parameters:
description
- the bean description
-
getComponentDescription
Description copied from interface:ComponentSourceAware
Return a human-readable description of this bean. Usually (if not set explicitly) aBeanDefinition.getDescription()
.- Specified by:
getComponentDescription
in interfaceComponentSourceAware
- Returns:
- the bean description (if any).
-
getBeanDescription
-
setBeanFactory
- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
setChannelResolver
Specify theDestinationResolver
strategy to use. The default is a BeanFactoryChannelResolver.- Parameters:
channelResolver
- The channel resolver.
-
getExpression
Description copied from interface:ExpressionCapable
Return the primary SpEL expression if this component is expression-based.- Specified by:
getExpression
in interfaceExpressionCapable
- Returns:
- the expression as a String.
-
setPrimaryExpression
For expression-based components, set the primary expression.- Parameters:
expression
- the expression.- Since:
- 4.3
-
afterPropertiesSet
public final void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
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.- Returns:
- the flag if this component has been initialized already.
-
getBeanFactory
-
setTaskScheduler
Configure aTaskScheduler
for those components which logic relies on the scheduled tasks. If not provided, falls back to the globaltaskScheduler
bean in the application context, provided by the Spring Integration infrastructure.- Parameters:
taskScheduler
- theTaskScheduler
to use.- Since:
- 5.1.3
- See Also:
-
getTaskScheduler
-
getChannelResolver
-
getConversionService
-
setConversionService
-
getApplicationContextId
Returns theApplicationContext.getId()
if theApplicationContext
is available.- Returns:
- The id, or null if there is no application context.
-
getApplicationContext
- Returns:
- the applicationContext
-
getIntegrationProperties
- Returns:
- The global integration properties.
- See Also:
-
getMessageBuilderFactory
-
setMessageBuilderFactory
-
toString
-
extractTypeIfPossible
-
generateId
-