Top Description Methods
org.springframework.beans.factory.xml

public Interface BeanDefinitionDecorator

Imports
org.w3c.dom.Node, org.springframework.beans.factory.config.BeanDefinitionHolder

Interface used by the DefaultBeanDefinitionDocumentReader 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 many BeanDefinitions as required and to transform the org.springframework.beans.factory.config.BeanDefinition of the enclosing <bean> tag, potentially even returning a completely different org.springframework.beans.factory.config.BeanDefinition to replace the original.

BeanDefinitionDecorators should be aware that they may be part of a chain. In particular, a BeanDefinitionDecorator should be aware that a previous BeanDefinitionDecorator may have replaced the original org.springframework.beans.factory.config.BeanDefinition with a org.springframework.aop.framework.ProxyFactoryBean definition allowing for custom interceptors to be added.

BeanDefinitionDecorators that wish to add an interceptor to the enclosing bean should extend org.springframework.aop.config.AbstractInterceptorDrivenBeanDefinitionDecorator 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 the NamespaceHandler for the namespace in which the custom tag resides.

Author
Rob Harrop
Since
2.0
See Also
NamespaceHandler, BeanDefinitionParser

Method Summary

Modifier and TypeMethod and Description
public BeanDefinitionHolder
decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext)

Parse the specified Node (either an element or an attribute) and decorate the supplied org.springframework.beans.factory.config.BeanDefinition, returning the decorated definition.

Method Detail

decorateback to summary
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext)

Parse the specified Node (either an element or an attribute) and decorate the supplied org.springframework.beans.factory.config.BeanDefinition, returning the decorated definition.

Implementations may choose to return a completely new definition, which will replace the original definition in the resulting org.springframework.beans.factory.BeanFactory.

The supplied ParserContext can be used to register any additional beans needed to support the main definition.