public class PooledProxyBeanDefinitionDecorator extends Object implements org.springframework.beans.factory.xml.BeanDefinitionDecorator
<bean id="myBean" class="some.pkg.MyBean"> <property name="gateApplication" ref="app" /> <gate:pooled-proxy max-size="3" /> </bean>
This replaces the myBean
bean with a proxy that
delegates to a pool of target objects. The targets are obtained by
converting the original myBean
definition to a
prototype-scoped bean definition and setting that as the
targetBeanName of a CommonsPoolTargetSource. The
CommonsPoolTargetSource is then used as the target source for a
standard ProxyFactoryBean, which is created with the scope specified
in the original myBean
definition (usually singleton).
If the pooled-proxy element has an attribute proxy-target-class, this value is passed through to the generated ProxyFactoryBean. All other attributes are passed through to the CommonsPoolTargetSource. The element also supports an initial-size attribute. If specified it will pre-populate the pool with this number of instances, which is useful if you want to load several copies of a saved application up-front (the normal behaviour of a Spring pool is to only instantiate the pooled objects as and when they are required).
NOTE In addition to the spring-aop
JAR, you also
need the Apache commons-pool
JAR and its dependencies
available to your application in order to use this class.
Modifier and Type | Field and Description |
---|---|
static String |
POOL_FILLER_PREFIX |
static String |
TARGET_PREFIX |
static String |
TARGET_SOURCE_PREFIX |
Constructor and Description |
---|
PooledProxyBeanDefinitionDecorator() |
Modifier and Type | Method and Description |
---|---|
org.springframework.beans.factory.config.BeanDefinitionHolder |
decorate(Node node,
org.springframework.beans.factory.config.BeanDefinitionHolder definition,
org.springframework.beans.factory.xml.ParserContext parserContext) |
public static final String TARGET_PREFIX
public static final String TARGET_SOURCE_PREFIX
public static final String POOL_FILLER_PREFIX
public org.springframework.beans.factory.config.BeanDefinitionHolder decorate(Node node, org.springframework.beans.factory.config.BeanDefinitionHolder definition, org.springframework.beans.factory.xml.ParserContext parserContext)
decorate
in interface org.springframework.beans.factory.xml.BeanDefinitionDecorator
Copyright © 2023 GATE. All rights reserved.