类 LazyInitTargetSourceCreator
java.lang.Object
infra.aop.framework.autoproxy.target.AbstractBeanFactoryTargetSourceCreator
infra.aop.framework.autoproxy.target.LazyInitTargetSourceCreator
- 所有已实现的接口:
TargetSourceCreator,infra.beans.factory.Aware,infra.beans.factory.BeanFactoryAware,infra.beans.factory.DisposableBean
TargetSourceCreator that enforces a LazyInitTargetSource for
each bean that is defined as "lazy-init". This will lead to a proxy created for
each of those beans, allowing to fetch a reference to such a bean without
actually initializing the target bean instance.
To be registered as custom TargetSourceCreator for an auto-proxy
creator, in combination with custom interceptors for specific beans or for the
creation of lazy-init proxies only. For example, as an autodetected
infrastructure bean in an XML application context definition:
<bean class="infra.aop.proxy.BeanNameAutoProxyCreator">
<property name="beanNames" value="*" /> <!-- apply to all beans -->
<property name="customTargetSourceCreators">
<list>
<bean class="infra.aop.proxy.target.LazyInitTargetSourceCreator" />
</list>
</property>
</bean>
<bean id="myLazyInitBean" class="mypackage.MyBeanClass" lazy-init="true">
<!-- ... -->
</bean>- 从以下版本开始:
- 4.0 2021/12/13 22:22
- 作者:
- Juergen Hoeller, Sam Brannen, Harry Yang
- 另请参阅:
-
BeanDefinition.isLazyInit()
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected 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.protected booleanReturn whether this TargetSourceCreator is prototype-based.从类继承的方法 infra.aop.framework.autoproxy.target.AbstractBeanFactoryTargetSourceCreator
buildInternalBeanFactory, destroy, getBeanFactory, getInternalBeanFactoryForBean, getTargetSource, setBeanFactory
-
构造器详细资料
-
LazyInitTargetSourceCreator
public LazyInitTargetSourceCreator()
-
-
方法详细资料
-
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".
- 覆盖:
isPrototypeBased在类中AbstractBeanFactoryTargetSourceCreator- 另请参阅:
-
BeanDefinition.isSingleton()
-
createBeanFactoryTargetSource
@Nullable protected 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.- 指定者:
createBeanFactoryTargetSource在类中AbstractBeanFactoryTargetSourceCreator- 参数:
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
-