org.springframework.aop.target
Class AbstractPrototypeBasedTargetSource

java.lang.Object
  extended byorg.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
      extended byorg.springframework.aop.target.AbstractPrototypeBasedTargetSource
All Implemented Interfaces:
BeanFactoryAware, Serializable, TargetSource
Direct Known Subclasses:
AbstractPoolingTargetSource, PrototypeTargetSource, ThreadLocalTargetSource

public abstract class AbstractPrototypeBasedTargetSource
extends AbstractBeanFactoryBasedTargetSource

Base class for dynamic TargetSources that can 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.

Author:
Rod Johnson, Juergen Hoeller
See Also:
BeanFactory.getBean(java.lang.String), PrototypeTargetSource, ThreadLocalTargetSource, CommonsPoolTargetSource, Serialized Form

Field Summary
 
Fields inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
logger
 
Constructor Summary
AbstractPrototypeBasedTargetSource()
           
 
Method Summary
protected  Object newPrototypeInstance()
          Subclasses should use this method to create a new prototype instance.
 void setBeanFactory(BeanFactory beanFactory)
          Set the owning BeanFactory.
 
Methods inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
getBeanFactory, getTargetBeanName, getTargetClass, isStatic, releaseTarget, setTargetBeanName, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.aop.TargetSource
getTarget
 

Constructor Detail

AbstractPrototypeBasedTargetSource

public AbstractPrototypeBasedTargetSource()
Method Detail

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
                    throws BeansException
Description copied from class: AbstractBeanFactoryBasedTargetSource
Set the owning BeanFactory. We need to save a reference so that we can use the getBean method on every invocation.

Specified by:
setBeanFactory in interface BeanFactoryAware
Overrides:
setBeanFactory in class AbstractBeanFactoryBasedTargetSource
Throws:
BeansException

newPrototypeInstance

protected Object newPrototypeInstance()
                               throws BeansException
Subclasses should use this method to create a new prototype instance.

Throws:
BeansException


Copyright (C) 2003-2004 The Spring Framework Project.