接口 BeanDefinitionDecorator
public interface BeanDefinitionDecorator
Interface used by theDefaultBeanDefinitionDocumentReader
to handle custom, nested (directly under a<bean>
) tags.Decoration may also occur based on custom attributes applied to the
<bean>
tag. Implementations are free to turn the metadata in the custom tag into as manyBeanDefinitions
as required and to transform theBeanDefinition
of the enclosing<bean>
tag, potentially even returning a completely differentBeanDefinition
to replace the original.BeanDefinitionDecorators
should be aware that they may be part of a chain. In particular, aBeanDefinitionDecorator
should be aware that a previousBeanDefinitionDecorator
may have replaced the originalBeanDefinition
with aProxyFactoryBean
definition allowing for custominterceptors
to be added.BeanDefinitionDecorators
that wish to add an interceptor to the enclosing bean should extendAbstractInterceptorDrivenBeanDefinitionDecorator
which handles the chaining ensuring that only one proxy is created and that it contains all interceptors from the chain.The parser locates a
BeanDefinitionDecorator
from theNamespaceHandler
for the namespace in which the custom tag resides.- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop
- 另请参阅:
NamespaceHandler
,BeanDefinitionParser
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 BeanDefinitionHolder
decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext)
Parse the specifiedNode
(either an element or an attribute) and decorate the suppliedBeanDefinition
, returning the decorated definition.
方法详细资料
decorate
BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext)
Parse the specifiedNode
(either an element or an attribute) and decorate the suppliedBeanDefinition
, returning the decorated definition.Implementations may choose to return a completely new definition, which will replace the original definition in the resulting
BeanFactory
.The supplied
ParserContext
can be used to register any additional beans needed to support the main definition.