|
spring-aop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator
public abstract class AbstractBeanFactoryBasedTargetSourceCreator
Convenient superclass for
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
AbstractBeanFactory.
AbstractBeanFactoryBasedTargetSource,
AbstractBeanFactory| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
|
| Constructor Summary | |
|---|---|
AbstractBeanFactoryBasedTargetSourceCreator()
|
|
| Method Summary | |
|---|---|
protected org.springframework.beans.factory.support.DefaultListableBeanFactory |
buildInternalBeanFactory(org.springframework.beans.factory.config.ConfigurableBeanFactory containingFactory)
Build an internal BeanFactory for resolving target beans. |
protected abstract AbstractBeanFactoryBasedTargetSource |
createBeanFactoryBasedTargetSource(java.lang.Class<?> beanClass,
java.lang.String beanName)
Subclasses must implement this method to return a new AbstractPrototypeBasedTargetSource if they wish to create a custom TargetSource for this bean, or null if they are
not interested it in, in which case no special target source will be created. |
void |
destroy()
Destroys the internal BeanFactory on shutdown of the TargetSourceCreator. |
protected org.springframework.beans.factory.BeanFactory |
getBeanFactory()
Return the BeanFactory that this TargetSourceCreators runs in. |
protected org.springframework.beans.factory.support.DefaultListableBeanFactory |
getInternalBeanFactoryForBean(java.lang.String beanName)
Return the internal BeanFactory to be used for the specified bean. |
TargetSource |
getTargetSource(java.lang.Class<?> beanClass,
java.lang.String beanName)
Create a special TargetSource for the given bean, if any. |
protected boolean |
isPrototypeBased()
Return whether this TargetSourceCreator is prototype-based. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public AbstractBeanFactoryBasedTargetSourceCreator()
| Method Detail |
|---|
public final void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareprotected final org.springframework.beans.factory.BeanFactory getBeanFactory()
public final TargetSource getTargetSource(java.lang.Class<?> beanClass,
java.lang.String beanName)
TargetSourceCreator
getTargetSource in interface TargetSourceCreatorbeanClass - the class of the bean to create a TargetSource forbeanName - the name of the bean
null if this TargetSourceCreator isn't
interested in the particular beanprotected org.springframework.beans.factory.support.DefaultListableBeanFactory getInternalBeanFactoryForBean(java.lang.String beanName)
beanName - the name of the target bean
protected org.springframework.beans.factory.support.DefaultListableBeanFactory buildInternalBeanFactory(org.springframework.beans.factory.config.ConfigurableBeanFactory containingFactory)
containingFactory - the containing BeanFactory that originally defines the beans
public void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeangetInternalBeanFactoryForBean(java.lang.String)protected boolean isPrototypeBased()
Default is "true".
BeanDefinition.isSingleton()
protected abstract AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(java.lang.Class<?> beanClass,
java.lang.String beanName)
null if they are
not interested it in, in which case no special target source will be created.
Subclasses should not call setTargetBeanName or setBeanFactory
on the AbstractPrototypeBasedTargetSource: This class' implementation of
getTargetSource() will do that.
beanClass - the class of the bean to create a TargetSource forbeanName - the name of the bean
null if we don't match this
|
spring-aop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||