public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource
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.
BeanFactory.getBean(java.lang.String),
PrototypeTargetSource,
ThreadLocalTargetSource,
CommonsPool2TargetSource,
Serialized Formlogger| Constructor and Description |
|---|
AbstractPrototypeBasedTargetSource() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
destroyPrototypeInstance(java.lang.Object target)
Subclasses should call this method to destroy an obsolete prototype instance.
|
protected java.lang.Object |
newPrototypeInstance()
Subclasses should call this method to create a new prototype instance.
|
private void |
readObject(java.io.ObjectInputStream ois) |
void |
setBeanFactory(BeanFactory beanFactory)
Set the owning BeanFactory.
|
protected java.lang.Object |
writeReplace()
Replaces this object with a SingletonTargetSource on serialization.
|
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, releaseTarget, setTargetBeanName, setTargetClass, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTargetpublic void setBeanFactory(BeanFactory beanFactory) throws BeansException
AbstractBeanFactoryBasedTargetSourcegetBean method on every invocation.setBeanFactory in interface BeanFactoryAwaresetBeanFactory in class AbstractBeanFactoryBasedTargetSourcebeanFactory - owning BeanFactory (never null).
The bean can immediately call methods on the factory.BeansException - in case of initialization errorsBeanInitializationExceptionprotected java.lang.Object newPrototypeInstance()
throws BeansException
BeansException - if bean creation failedprotected void destroyPrototypeInstance(java.lang.Object target)
target - the bean instance to destroyprivate void readObject(java.io.ObjectInputStream ois)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected java.lang.Object writeReplace()
throws java.io.ObjectStreamException
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.
java.io.ObjectStreamException