|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator
public abstract class AbstractBeanFactoryBasedTargetSourceCreator
Convenient superclass for TargetSourceCreators 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 Log |
logger
|
Constructor Summary | |
---|---|
AbstractBeanFactoryBasedTargetSourceCreator()
|
Method 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 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 BeanFactory |
getBeanFactory()
Return the BeanFactory that this TargetSourceCreators runs in. |
TargetSource |
getTargetSource(Class beanClass,
String beanName)
Create a special TargetSource for the given bean, if any. |
protected boolean |
isPrototypeBased()
Return whether this TargetSourceCreator is prototype-based. |
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Log logger
Constructor Detail |
---|
public AbstractBeanFactoryBasedTargetSourceCreator()
Method Detail |
---|
public final void setBeanFactory(BeanFactory beanFactory)
BeanFactoryAware
Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method.
setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (may not be null).
The bean can immediately call methods on the factory.BeanInitializationException
protected final BeanFactory getBeanFactory()
public final TargetSource getTargetSource(Class beanClass, String beanName)
TargetSourceCreator
getTargetSource
in interface TargetSourceCreator
beanClass
- the class of the bean to create a TargetSource forbeanName
- the name of the bean
protected boolean isPrototypeBased()
protected abstract AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(Class beanClass, String beanName)
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
public void destroy()
destroy
in interface DisposableBean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |