org.springframework.aop.framework.autoproxy.target

## 类 LazyInitTargetSourceCreator

- java.lang.Object
- - org.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator
  - - org.springframework.aop.framework.autoproxy.target.LazyInitTargetSourceCreator

- 所有已实现的接口:
    TargetSourceCreator, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean

      public class LazyInitTargetSourceCreator
      extends AbstractBeanFactoryBasedTargetSourceCreator

  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 autodetected infrastructure bean in an XML application context definition:

       <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
         <property name="customTargetSourceCreators">
           <list>
             <bean class="org.springframework.aop.framework.autoproxy.target.LazyInitTargetSourceCreator"/>
           </list>
         </property>
       </bean>

       <bean id="myLazyInitBean" class="mypackage.MyBeanClass" lazy-init="true">
         ...
       </bean>

  从以下版本开始:
    1.2
  作者:
    Juergen Hoeller
  另请参阅:
    `BeanDefinition.isLazyInit()`, `AbstractAutoProxyCreator.setCustomTargetSourceCreators(org.springframework.aop.framework.autoproxy.TargetSourceCreator...)`, `BeanNameAutoProxyCreator`

- - ### 字段概要

    - ### 从类继承的字段 org.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator

      `logger`

  - ### 构造器概要

    构造器
    构造器和说明
    `LazyInitTargetSourceCreator()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected 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.
    `protected boolean` | `isPrototypeBased()` Return whether this TargetSourceCreator is prototype-based.

    - ### 从类继承的方法 org.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator

      `buildInternalBeanFactory, destroy, getBeanFactory, getInternalBeanFactoryForBean, getTargetSource, setBeanFactory`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### LazyInitTargetSourceCreator

          public LazyInitTargetSourceCreator()

  - ### 方法详细资料

    - #### isPrototypeBased

          protected boolean isPrototypeBased()

      从类复制的说明: `AbstractBeanFactoryBasedTargetSourceCreator`
      Return whether this TargetSourceCreator is prototype-based. The scope of the target bean definition will be set accordingly.

      Default is "true".

      覆盖:
        `isPrototypeBased` 在类中 `AbstractBeanFactoryBasedTargetSourceCreator`
      另请参阅:
        `BeanDefinition.isSingleton()`

    - #### createBeanFactoryBasedTargetSource

          @Nullable
          protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(Class<?> beanClass,
                                                                                                       String beanName)

      从类复制的说明: `AbstractBeanFactoryBasedTargetSourceCreator`
      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. Subclasses should not call `setTargetBeanName` or `setBeanFactory` on the AbstractPrototypeBasedTargetSource: This class' implementation of `getTargetSource()` will do that.
      指定者:
        `createBeanFactoryBasedTargetSource` 在类中 `AbstractBeanFactoryBasedTargetSourceCreator`
      参数:
        `beanClass` - the class of the bean to create a TargetSource for
        `beanName` - the name of the bean
      返回:
        the AbstractPrototypeBasedTargetSource, or `null` if we don't match this