|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.access.SingletonBeanFactoryLocator org.springframework.context.access.ContextSingletonBeanFactoryLocator
public class ContextSingletonBeanFactoryLocator
Variant of SingletonBeanFactoryLocator which creates its internal bean factory reference definition as an ApplicationContext instead of SingletonBeanFactoryLocator's BeanFactory. For almost all usage scenarios, this will not make a difference, since withing that ApplicationContext or BeanFactory you are still free to create either BeanFactories or ApplicationContexts. The main reason one would need to use this class is if BeanPostProcessing (or other ApplicationContext specific features are needed in the bean reference definition itself.
Note: This class uses classpath*:beanRefContext.xml as the default name for the bean factory reference definition. It is not possible nor legal to share definitions with SingletonBeanFactoryLocator at the same time.
DefaultLocatorFactory
Field Summary |
---|
Fields inherited from class org.springframework.beans.factory.access.SingletonBeanFactoryLocator |
---|
logger |
Constructor Summary | |
---|---|
protected |
ContextSingletonBeanFactoryLocator()
Constructor which uses the default "classpath*:beanRefContext.xml", as the name of the definition file(s). |
protected |
ContextSingletonBeanFactoryLocator(String resourceName)
Constructor which uses the the specified name as the name of the definition file(s). |
Method Summary | |
---|---|
protected BeanFactory |
createDefinition(String resourceName,
String factoryKey)
Overrides default method to create definition object as an ApplicationContext instead of the default BeanFactory. |
protected void |
destroyDefinition(BeanFactory groupDef,
String resourceName)
Overrides default method to work with ApplicationContext |
static BeanFactoryLocator |
getInstance()
Returns an instance which uses the default "classpath*:beanRefContext.xml", as the name of the definition file(s). |
static BeanFactoryLocator |
getInstance(String selector)
Returns an instance which uses the the specified selector, as the name of the definition file(s). |
protected void |
initializeDefinition(BeanFactory groupDef)
Overrides default method to initialize definition object, which this method assumes is a ConfigurableApplicationContext. |
Methods inherited from class org.springframework.beans.factory.access.SingletonBeanFactoryLocator |
---|
useBeanFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ContextSingletonBeanFactoryLocator()
protected ContextSingletonBeanFactoryLocator(String resourceName)
Method Detail |
---|
public static BeanFactoryLocator getInstance() throws BeansException
BeansException
public static BeanFactoryLocator getInstance(String selector) throws BeansException
getResources
method will be called with this value to get
all resources having that name. These resources will then be combined to form a
definition. In the case where the name uses a Spring "classpath:" prefix, or
a standard URL prefix, then only one resource file will be loaded as the
definition.
selector
- the name of the resource(s) which will be read and combine to
form the definition for the SingletonBeanFactoryLocator instance. The one file
or multiple fragments with this name must form a valid ApplicationContext
definition.
BeansException
protected BeanFactory createDefinition(String resourceName, String factoryKey) throws BeansException
createDefinition
in class SingletonBeanFactoryLocator
BeansException
protected void initializeDefinition(BeanFactory groupDef) throws BeansException
ConfigurableApplicationContext.refresh()
.
initializeDefinition
in class SingletonBeanFactoryLocator
groupDef
- the factory returned by createDefinition()
BeansException
protected void destroyDefinition(BeanFactory groupDef, String resourceName) throws BeansException
destroyDefinition
in class SingletonBeanFactoryLocator
BeansException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |