类 AbstractBeanFactoryTargetSourceCreator
java.lang.Object
cn.taketoday.aop.framework.autoproxy.target.AbstractBeanFactoryTargetSourceCreator
- 所有已实现的接口:
TargetSourceCreator,Aware,BeanFactoryAware,DisposableBean
public abstract class AbstractBeanFactoryTargetSourceCreator
extends Object
implements TargetSourceCreator, BeanFactoryAware, DisposableBean
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.
- 从以下版本开始:
- 4.0 2021/12/13 22:24
- 作者:
- Rod Johnson, Juergen Hoeller, Harry Yang
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected StandardBeanFactorybuildInternalBeanFactory(ConfigurableBeanFactory containingFactory) Build an internal BeanFactory for resolving target beans.protected abstract AbstractBeanFactoryTargetSourcecreateBeanFactoryTargetSource(Class<?> beanClass, String beanName) Subclasses must implement this method to return a new AbstractPrototypeTargetSource if they wish to create a custom TargetSource for this bean, ornullif they are not interested it in, in which case no special target source will be created.voiddestroy()Destroys the internal BeanFactory on shutdown of the TargetSourceCreator.protected final BeanFactoryReturn the BeanFactory that this TargetSourceCreators runs in.protected StandardBeanFactorygetInternalBeanFactoryForBean(String beanName) Return the internal BeanFactory to be used for the specified bean.final TargetSourcegetTargetSource(Class<?> beanClass, String beanName) Create a special TargetSource for the given bean, if any.protected booleanReturn whether this TargetSourceCreator is prototype-based.final voidsetBeanFactory(BeanFactory beanFactory)
-
构造器详细资料
-
AbstractBeanFactoryTargetSourceCreator
public AbstractBeanFactoryTargetSourceCreator()
-
-
方法详细资料
-
setBeanFactory
- 指定者:
setBeanFactory在接口中BeanFactoryAware
-
getBeanFactory
Return the BeanFactory that this TargetSourceCreators runs in. -
getTargetSource
从接口复制的说明:TargetSourceCreatorCreate a special TargetSource for the given bean, if any.- 指定者:
getTargetSource在接口中TargetSourceCreator- 参数:
beanClass- the class of the bean to create a TargetSource forbeanName- the name of the bean- 返回:
- a special TargetSource or
nullif this TargetSourceCreator isn't interested in the particular bean
-
getInternalBeanFactoryForBean
Return the internal BeanFactory to be used for the specified bean.- 参数:
beanName- the name of the target bean- 返回:
- the internal BeanFactory to be used
-
buildInternalBeanFactory
Build an internal BeanFactory for resolving target beans.- 参数:
containingFactory- the containing BeanFactory that originally defines the beans- 返回:
- an independent internal BeanFactory to hold copies of some target beans
-
destroy
public void destroy()Destroys the internal BeanFactory on shutdown of the TargetSourceCreator.- 指定者:
destroy在接口中DisposableBean- 另请参阅:
-
isPrototypeBased
protected boolean isPrototypeBased()Return whether this TargetSourceCreator is prototype-based. The scope of the target bean definition will be set accordingly.Default is "true".
-
createBeanFactoryTargetSource
@Nullable protected abstract AbstractBeanFactoryTargetSource createBeanFactoryTargetSource(Class<?> beanClass, String beanName) Subclasses must implement this method to return a new AbstractPrototypeTargetSource if they wish to create a custom TargetSource for this bean, ornullif they are not interested it in, in which case no special target source will be created. Subclasses should not callsetTargetBeanNameorsetBeanFactoryon the AbstractPrototypeTargetSource: This class' implementation ofgetTargetSource()will do that.- 参数:
beanClass- the class of the bean to create a TargetSource forbeanName- the name of the bean- 返回:
- the AbstractPrototypeBasedTargetSource, or
nullif we don't match this
-