org.springframework.aop.target

## 类 AbstractPrototypeBasedTargetSource

- java.lang.Object
- - org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
  - - org.springframework.aop.target.AbstractPrototypeBasedTargetSource

- 所有已实现的接口:
    Serializable, TargetClassAware, TargetSource, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware
  直接已知子类:
    AbstractPoolingTargetSource, PrototypeTargetSource, ThreadLocalTargetSource

      public abstract class AbstractPrototypeBasedTargetSource
      extends AbstractBeanFactoryBasedTargetSource

  Base class for dynamic `TargetSource` implementations that create new prototype bean instances to support a pooling or new-instance-per-invocation strategy.

  Such TargetSources must run in a `BeanFactory`, as it needs to call the `getBean` method to create a new prototype instance. Therefore, this base class extends `AbstractBeanFactoryBasedTargetSource`.

  作者:
    Rod Johnson, Juergen Hoeller
  另请参阅:
    `BeanFactory.getBean(java.lang.String)`, `PrototypeTargetSource`, `ThreadLocalTargetSource`, `CommonsPool2TargetSource`, 序列化表格

- - ### 字段概要

    - ### 从类继承的字段 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource

      `logger`

  - ### 构造器概要

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

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | `destroyPrototypeInstance(Object target)` Subclasses should call this method to destroy an obsolete prototype instance.
    `protected Object` | `newPrototypeInstance()` Subclasses should call this method to create a new prototype instance.
    `void` | `setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)` Set the owning BeanFactory.
    `protected Object` | `writeReplace()` Replaces this object with a SingletonTargetSource on serialization.

    - ### 从类继承的方法 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource

      `copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, releaseTarget, setTargetBeanName, setTargetClass, toString`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### 从接口继承的方法 org.springframework.aop.TargetSource

      `getTarget`

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

    - #### AbstractPrototypeBasedTargetSource

          public AbstractPrototypeBasedTargetSource()

  - ### 方法详细资料

    - #### setBeanFactory

          public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                              throws org.springframework.beans.BeansException

      从类复制的说明: `AbstractBeanFactoryBasedTargetSource`
      Set the owning BeanFactory. We need to save a reference so that we can use the `getBean` method on every invocation.
      指定者:
        `setBeanFactory` 在接口中 `org.springframework.beans.factory.BeanFactoryAware`
      覆盖:
        `setBeanFactory` 在类中 `AbstractBeanFactoryBasedTargetSource`
      抛出:
        `org.springframework.beans.BeansException`

    - #### newPrototypeInstance

          protected Object newPrototypeInstance()
                                         throws org.springframework.beans.BeansException

      Subclasses should call this method to create a new prototype instance.
      抛出:
        `org.springframework.beans.BeansException` - if bean creation failed

    - #### destroyPrototypeInstance

          protected void destroyPrototypeInstance(Object target)

      Subclasses should call this method to destroy an obsolete prototype instance.
      参数:
        `target` - the bean instance to destroy

    - #### writeReplace

          protected Object writeReplace()
                                 throws ObjectStreamException

      Replaces this object with a SingletonTargetSource on serialization. Protected as otherwise it won't be invoked for subclasses. (The `writeReplace()` method must be visible to the class being serialized.)

      With this implementation of this method, there is no need to mark non-serializable fields in this class or subclasses as transient.

      抛出:
        `ObjectStreamException`