类 ContextBeanFactoryReference
- java.lang.Object
- org.springframework.context.access.ContextBeanFactoryReference
- 所有已实现的接口:
BeanFactoryReference
public class ContextBeanFactoryReference extends Object implements BeanFactoryReference
ApplicationContext-specific implementation of BeanFactoryReference, wrapping a newly created ApplicationContext, closing it on release.As per BeanFactoryReference contract,
release
may be called more than once, with subsequent calls not doing anything. However, callinggetFactory
after arelease
call will cause an exception.- 从以下版本开始:
- 13.02.2004
- 作者:
- Juergen Hoeller, Colin Sampaleanu
- 另请参阅:
ConfigurableApplicationContext.close()
构造器概要
构造器 构造器 说明 ContextBeanFactoryReference(ApplicationContext applicationContext)
Create a new ContextBeanFactoryReference for the given context.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 BeanFactory
getFactory()
Return theBeanFactory
instance held by this reference.void
release()
Indicate that theBeanFactory
instance referred to by this object is not needed any longer by the client code which obtained theBeanFactoryReference
.
构造器详细资料
ContextBeanFactoryReference
public ContextBeanFactoryReference(ApplicationContext applicationContext)
Create a new ContextBeanFactoryReference for the given context.- 参数:
applicationContext
- the ApplicationContext to wrap
方法详细资料
getFactory
public BeanFactory getFactory()
从接口复制的说明:BeanFactoryReference
Return theBeanFactory
instance held by this reference.- 指定者:
getFactory
在接口中BeanFactoryReference
release
public void release()
从接口复制的说明:BeanFactoryReference
Indicate that theBeanFactory
instance referred to by this object is not needed any longer by the client code which obtained theBeanFactoryReference
.Depending on the actual implementation of
BeanFactoryLocator
, and the actual type ofBeanFactory
, this may possibly not actually do anything; alternately in the case of a 'closeable'BeanFactory
or derived class (such asApplicationContext
) may 'close' it, or may 'close' it once no more references remain.In an EJB usage scenario this would normally be called from
ejbRemove()
andejbPassivate()
.This is safe to call multiple times.