|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource org.springframework.aop.target.AbstractPrototypeBasedTargetSource
public abstract class AbstractPrototypeBasedTargetSource
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
.
BeanFactory.getBean(java.lang.String)
,
PrototypeTargetSource
,
ThreadLocalTargetSource
,
CommonsPoolTargetSource
,
Serialized FormField Summary |
---|
Fields inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource |
---|
logger |
Constructor Summary | |
---|---|
AbstractPrototypeBasedTargetSource()
|
Method Summary | |
---|---|
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(BeanFactory beanFactory)
Set the owning BeanFactory. |
protected Object |
writeReplace()
Replaces this object with a SingletonTargetSource on serialization. |
Methods inherited from class org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource |
---|
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, releaseTarget, setTargetBeanName, setTargetClass, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.aop.TargetSource |
---|
getTarget |
Constructor Detail |
---|
public AbstractPrototypeBasedTargetSource()
Method Detail |
---|
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
AbstractBeanFactoryBasedTargetSource
getBean
method on every invocation.
setBeanFactory
in interface BeanFactoryAware
setBeanFactory
in class AbstractBeanFactoryBasedTargetSource
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.
BeansException
- in case of initialization errorsBeanInitializationException
protected Object newPrototypeInstance() throws BeansException
BeansException
- if bean creation failedprotected void destroyPrototypeInstance(Object target)
target
- the bean instance to destroyprotected Object writeReplace() throws 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.
ObjectStreamException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |