org.springframework.aop.target

## Class PrototypeTargetSource

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

- All Implemented Interfaces:
    Serializable, TargetClassAware, TargetSource, Aware, BeanFactoryAware

      public class PrototypeTargetSource
      extends AbstractPrototypeBasedTargetSource

  `TargetSource` implementation that creates a new instance of the target bean for each request, destroying each instance on release (after each request).

  Obtains bean instances from its containing `BeanFactory`.

  Author:
    Rod Johnson, Juergen Hoeller
  See Also:
    `AbstractPrototypeBasedTargetSource.setBeanFactory(org.springframework.beans.factory.BeanFactory)`, `AbstractBeanFactoryBasedTargetSource.setTargetBeanName(java.lang.String)`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrototypeTargetSource()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getTarget()` Obtain a new prototype instance for every call.
    `void` | `releaseTarget(Object target)` Destroy the given independent instance.
    `String` | `toString()`

    - ### Methods inherited from class org.springframework.aop.target.AbstractPrototypeBasedTargetSource

      `destroyPrototypeInstance, newPrototypeInstance, setBeanFactory, writeReplace`

    - ### Methods inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource

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

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### PrototypeTargetSource

          public PrototypeTargetSource()

  - ### Method Detail

    - #### getTarget

          public Object getTarget()
                           throws BeansException

      Obtain a new prototype instance for every call.
      Returns:
        the target object which contains the joinpoint, or `null` if there is no actual target instance
      Throws:
        `BeansException`
      See Also:
        `AbstractPrototypeBasedTargetSource.newPrototypeInstance()`

    - #### releaseTarget

          public void releaseTarget(Object target)

      Destroy the given independent instance.
      Specified by:
        `releaseTarget` in interface `TargetSource`
      Overrides:
        `releaseTarget` in class `AbstractBeanFactoryBasedTargetSource`
      Parameters:
        `target` - object obtained from a call to `TargetSource.getTarget()`
      See Also:
        `AbstractPrototypeBasedTargetSource.destroyPrototypeInstance(java.lang.Object)`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AbstractBeanFactoryBasedTargetSource`