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,AbstractMessageProcessingTransformer,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, Glenn Renfro
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final ExpressionParserprotected final LogAccessor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidstatic <T> @Nullable TextractTypeIfPossible(@Nullable Object targetObject, Class<T> expectedType) static UUIDprotected ApplicationContext@Nullable StringReturns theApplicationContext.getId()if theApplicationContextis available.protected BeanFactoryReturn the bean name populated by theBeanNameAware.setBeanName(String).protected DestinationResolver<MessageChannel> @Nullable StringReturn a human-readable description of this bean.Will return the name of this component identified bycomponentNamefield.@Nullable ObjectReturn the configuration sourceObjectfor this bean (maybenull).@Nullable ExpressionReturn the primary SpEL expression if this component is expression-based.protected IntegrationPropertiesprotected MessageBuilderFactoryprotected TaskSchedulerprotected booleanReturn the status of this component if it has been initialized already.protected voidonInit()Subclasses may implement this for initialization logic.voidsetApplicationContext(ApplicationContext applicationContext) voidsetBeanFactory(BeanFactory beanFactory) final voidsetBeanName(String beanName) voidsetChannelResolver(DestinationResolver<MessageChannel> channelResolver) Specify theDestinationResolverstrategy to use.voidsetComponentDescription(String description) Set a human-readable description of this bean.voidsetComponentName(String componentName) Sets the name of this component.voidsetComponentSource(Object source) Set a configuration sourceObjectfor this bean definition.voidsetConversionService(ConversionService conversionService) voidsetMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory) final voidsetPrimaryExpression(Expression expression) For expression-based components, set the primary expression.voidsetTaskScheduler(TaskScheduler taskScheduler) Configure aTaskSchedulerfor those components which logic relies on the scheduled tasks.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getComponentType
-
Field Details
-
EXPRESSION_PARSER
-
logger
-
-
Constructor Details
-
IntegrationObjectSupport
public IntegrationObjectSupport()
-
-
Method Details
-
setBeanName
- Specified by:
setBeanNamein interfaceBeanNameAware
-
getBeanName
Description copied from interface:ComponentSourceAwareReturn the bean name populated by theBeanNameAware.setBeanName(String).- Specified by:
getBeanNamein interfaceComponentSourceAware- Specified by:
getBeanNamein interfaceNamedComponent- Returns:
- the bean name.
-
getComponentName
Will return the name of this component identified bycomponentNamefield. IfcomponentNamewas not set this method will default to the 'beanName' of this component;- Specified by:
getComponentNamein interfaceNamedComponent
-
setComponentName
Sets the name of this component.- Parameters:
componentName- The component name.
-
setComponentSource
Description copied from interface:ComponentSourceAwareSet a configuration sourceObjectfor this bean definition. For normalBeanDefinitionthis is supplied by application context automatically. Could be useful when bean is registered at runtime viaSingletonBeanRegistry.registerSingleton(String, Object)- Specified by:
setComponentSourcein interfaceComponentSourceAware- Parameters:
source- the configuration source
-
getComponentSource
Description copied from interface:ComponentSourceAwareReturn the configuration sourceObjectfor this bean (maybenull). Usually (if not set explicitly) aBeanMetadataElement.getSource().- Specified by:
getComponentSourcein interfaceComponentSourceAware- Returns:
- the configuration source for the bean (if any).
-
setComponentDescription
Description copied from interface:ComponentSourceAwareSet a human-readable description of this bean. For normal bean definition aBeanDefinition.getDescription()is used.- Specified by:
setComponentDescriptionin interfaceComponentSourceAware- Parameters:
description- the bean description
-
getComponentDescription
Description copied from interface:ComponentSourceAwareReturn a human-readable description of this bean. Usually (if not set explicitly) aBeanDefinition.getDescription().- Specified by:
getComponentDescriptionin interfaceComponentSourceAware- Returns:
- the bean description (if any).
-
getBeanDescription
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
setChannelResolver
Specify theDestinationResolverstrategy to use. The default is a BeanFactoryChannelResolver.- Parameters:
channelResolver- The channel resolver.
-
getExpression
Description copied from interface:ExpressionCapableReturn the primary SpEL expression if this component is expression-based.- Specified by:
getExpressionin 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:
afterPropertiesSetin 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 aTaskSchedulerfor those components which logic relies on the scheduled tasks. If not provided, falls back to the globaltaskSchedulerbean in the application context, provided by the Spring Integration infrastructure.- Parameters:
taskScheduler- theTaskSchedulerto use.- Since:
- 5.1.3
- See Also:
-
getTaskScheduler
-
getChannelResolver
-
setConversionService
-
getConversionService
-
getApplicationContextId
Returns theApplicationContext.getId()if theApplicationContextis 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
-