类 AbstractPrototypeBasedTargetSource
- java.lang.Object
- org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
- org.springframework.aop.target.AbstractPrototypeBasedTargetSource
- 所有已实现的接口:
Serializable
,TargetClassAware
,TargetSource
,Aware
,BeanFactoryAware
public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFactoryBasedTargetSource
Base class for dynamicTargetSource
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 thegetBean
method to create a new prototype instance. Therefore, this base class extendsAbstractBeanFactoryBasedTargetSource
.- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
BeanFactory.getBean(java.lang.String)
,PrototypeTargetSource
,ThreadLocalTargetSource
,CommonsPool2TargetSource
, 序列化表格
字段概要
从类继承的字段 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
logger
构造器概要
构造器 构造器 说明 AbstractPrototypeBasedTargetSource()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource
copyFrom, equals, getBeanFactory, getTargetBeanName, getTargetClass, hashCode, isStatic, releaseTarget, setTargetBeanName, setTargetClass, toString
从接口继承的方法 org.springframework.aop.TargetSource
getTarget
构造器详细资料
AbstractPrototypeBasedTargetSource
public AbstractPrototypeBasedTargetSource()
方法详细资料
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
从类复制的说明:AbstractBeanFactoryBasedTargetSource
Set the owning BeanFactory. We need to save a reference so that we can use thegetBean
method on every invocation.- 指定者:
setBeanFactory
在接口中BeanFactoryAware
- 覆盖:
setBeanFactory
在类中AbstractBeanFactoryBasedTargetSource
- 参数:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- 抛出:
BeansException
- in case of initialization errors- 另请参阅:
BeanInitializationException
newPrototypeInstance
protected Object newPrototypeInstance() throws BeansException
Subclasses should call this method to create a new prototype instance.- 抛出:
BeansException
- if bean creation failed
destroyPrototypeInstance
protected void destroyPrototypeInstance(Object target)
Subclasses should call this method to destroy an obsolete prototype instance.- 参数:
target
- the bean instance to destroy
writeReplace
protected Object writeReplace() throws ObjectStreamException
Replaces this object with a SingletonTargetSource on serialization. Protected as otherwise it won't be invoked for subclasses. (ThewriteReplace()
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.