org.springframework.aop.framework.autoproxy.TargetSourceCreator
implementations that require creating multiple instances of a prototype bean.
Uses an internal BeanFactory to manage the target instances, copying the original bean definition to this internal factory. This is necessary because the original BeanFactory will just contain the proxy instance created through auto-proxying.
Requires running in an
org..
org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource , org.springframework.beans.factory.support.AbstractBeanFactory
| Modifier and Type | Field and Description |
|---|---|
| private ConfigurableBeanFactory | |
| private final Map | internalBeanFactories
Internally used DefaultListableBeanFactory instances, keyed by bean name. |
| protected final Log |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected DefaultListableBeanFactory | Returns: an independent internal BeanFactory to hold copies of some target beansthe containing BeanFactory that originally defines the beans containingFactory)Build an internal BeanFactory for resolving target beans. |
| protected abstract AbstractBeanFactoryBasedTargetSource | Returns: the AbstractPrototypeBasedTargetSource, ornull if we don't match thisthe class of the bean to create a TargetSource for beanClass, String the name of the bean beanName)Subclasses must implement this method to return a new AbstractPrototypeBasedTargetSource
if they wish to create a custom TargetSource for this bean, or |
| public void | destroy()
Implements org. Destroys the internal BeanFactory on shutdown of the TargetSourceCreator. |
| protected final BeanFactory | |
| private ConfigurableBeanFactory | |
| protected DefaultListableBeanFactory | Returns: the internal BeanFactory to be usedthe name of the target bean beanName)Return the internal BeanFactory to be used for the specified bean. |
| public final TargetSource | getTargetSource(Class<?>
the class of the bean to create a TargetSource for beanClass, String the name of the bean beanName)Implements org. Create a special TargetSource for the given bean, if any. |
| protected boolean | |
| public final void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. Callback that supplies the owning factory to a bean instance. |
| beanFactory | back to summary |
|---|---|
| private ConfigurableBeanFactory beanFactory
| |
| internalBeanFactories | back to summary |
|---|---|
| private final Map<String, DefaultListableBeanFactory> internalBeanFactories Internally used DefaultListableBeanFactory instances, keyed by bean name. | |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| AbstractBeanFactoryBasedTargetSourceCreator | back to summary |
|---|---|
| public AbstractBeanFactoryBasedTargetSourceCreator() | |
| buildInternalBeanFactory | back to summary |
|---|---|
| protected DefaultListableBeanFactory buildInternalBeanFactory(ConfigurableBeanFactory containingFactory) Build an internal BeanFactory for resolving target beans.
| |
| createBeanFactoryBasedTargetSource | back to summary |
|---|---|
| protected abstract AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(Class<?> beanClass, String beanName) Subclasses must implement this method to return a new AbstractPrototypeBasedTargetSource
if they wish to create a custom TargetSource for this bean, or
| |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. Destroys the internal BeanFactory on shutdown of the TargetSourceCreator.
| |
| getBeanFactory | back to summary |
|---|---|
| protected final BeanFactory getBeanFactory() Return the BeanFactory that this TargetSourceCreators runs in.
| |
| getConfigurableBeanFactory | back to summary |
|---|---|
| private ConfigurableBeanFactory getConfigurableBeanFactory() | |
| getInternalBeanFactoryForBean | back to summary |
|---|---|
| protected DefaultListableBeanFactory getInternalBeanFactoryForBean(String beanName) Return the internal BeanFactory to be used for the specified bean.
| |
| getTargetSource | back to summary |
|---|---|
| public final TargetSource getTargetSource(Class<?> beanClass, String beanName) Implements org. Doc from org. Create a special TargetSource for the given bean, if any.
| |
| isPrototypeBased | back to summary |
|---|---|
| protected boolean isPrototypeBased() Return whether this TargetSourceCreator is prototype-based. The scope of the target bean definition will be set accordingly. Default is "true". | |
| setBeanFactory | back to summary |
|---|---|
| public final void setBeanFactory(BeanFactory beanFactory) Implements org. Doc from org. Callback that supplies the owning factory to a bean instance. Invoked after the population of normal bean properties
but before an initialization callback such as
| |