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
.
AbstractPrototypeBasedTargetSource.setBeanFactory(org.springframework.beans.factory.BeanFactory)
,
AbstractBeanFactoryBasedTargetSource.setTargetBeanName(java.lang.String)
,
Serialized Formlogger
Constructor and Description |
---|
PrototypeTargetSource() |
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() |
destroyPrototypeInstance, newPrototypeInstance, setBeanFactory, writeReplace
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, setTargetBeanName, setTargetClass
public Object getTarget() throws BeansException
null
if there is no actual target instanceBeansException
AbstractPrototypeBasedTargetSource.newPrototypeInstance()
public void releaseTarget(Object target)
releaseTarget
in interface TargetSource
releaseTarget
in class AbstractBeanFactoryBasedTargetSource
target
- object obtained from a call to TargetSource.getTarget()
AbstractPrototypeBasedTargetSource.destroyPrototypeInstance(java.lang.Object)
public String toString()
toString
in class AbstractBeanFactoryBasedTargetSource