|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.target.AbstractPrototypeBasedTargetSource
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.
PrototypeBasedTargetSources are serializable. This involves disconnecting the current target and turning into a SingletonTargetSource.
BeanFactory.getBean(java.lang.String)
,
Serialized FormField Summary | |
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
AbstractPrototypeBasedTargetSource()
|
Method Summary | |
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
java.lang.String |
getTargetBeanName()
Return the name of the target bean in the factory. |
java.lang.Class |
getTargetClass()
Return the type of targets returned by this TargetSource. |
boolean |
isStatic()
Will all calls to getTarget() return the same object? |
protected java.lang.Object |
newPrototypeInstance()
Subclasses should use this method to create a new prototype instance. |
void |
setBeanFactory(BeanFactory beanFactory)
Set the owning BeanFactory. |
void |
setTargetBeanName(java.lang.String targetBeanName)
Set the name of the target bean in the factory. |
protected java.lang.Object |
writeReplace()
Replaces this object with a SingletonTargetSource on serialization. |
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, releaseTarget |
Field Detail |
protected final org.apache.commons.logging.Log logger
Constructor Detail |
public AbstractPrototypeBasedTargetSource()
Method Detail |
public void setTargetBeanName(java.lang.String targetBeanName)
targetBeanName
- name of the target bean in the BeanFactory
that owns this interceptorpublic java.lang.String getTargetBeanName()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (may not be null).
The bean can immediately call methods on the factory.
BeansException
- in case of initialization errorsBeanInitializationException
public void afterPropertiesSet()
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
public java.lang.Class getTargetClass()
TargetSource
getTargetClass
in interface TargetSource
public boolean isStatic()
TargetSource
isStatic
in interface TargetSource
protected java.lang.Object newPrototypeInstance()
protected java.lang.Object writeReplace() throws java.io.ObjectStreamException
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
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |