|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.beans.factory.access.SingletonBeanFactoryLocator
org.springframework.context.access.ContextSingletonBeanFactoryLocator
public class ContextSingletonBeanFactoryLocator
Variant of SingletonBeanFactoryLocator
which creates its internal bean factory reference as an
ApplicationContext
instead of
SingletonBeanFactoryLocator's simple BeanFactory. For almost all usage scenarios,
this will not make a difference, since within that ApplicationContext or BeanFactory
you are still free to define either BeanFactory or ApplicationContext instances.
The main reason one would need to use this class is if bean post-processing
(or other ApplicationContext specific features are needed in the bean reference
definition itself).
Note: This class uses classpath*:beanRefContext.xml as the default resource location for the bean factory reference definition files. It is not possible nor legal to share definitions with SingletonBeanFactoryLocator at the same time.
SingletonBeanFactoryLocator
,
DefaultLocatorFactory
Field Summary |
---|
Fields inherited from class org.springframework.beans.factory.access.SingletonBeanFactoryLocator |
---|
logger |
Constructor Summary | |
---|---|
protected |
ContextSingletonBeanFactoryLocator(java.lang.String resourceLocation)
Constructor which uses the the specified name as the resource name of the definition file(s). |
Method Summary | |
---|---|
protected org.springframework.beans.factory.BeanFactory |
createDefinition(java.lang.String resourceLocation,
java.lang.String factoryKey)
Overrides the default method to create definition object as an ApplicationContext instead of the default BeanFactory. |
protected void |
destroyDefinition(org.springframework.beans.factory.BeanFactory groupDef,
java.lang.String selector)
Overrides the default method to operate on an ApplicationContext, invoking ConfigurableApplicationContext.close() . |
static org.springframework.beans.factory.access.BeanFactoryLocator |
getInstance()
Returns an instance which uses the default "classpath*:beanRefContext.xml", as the name of the definition file(s). |
static org.springframework.beans.factory.access.BeanFactoryLocator |
getInstance(java.lang.String selector)
Returns an instance which uses the the specified selector, as the name of the definition file(s). |
protected void |
initializeDefinition(org.springframework.beans.factory.BeanFactory groupDef)
Overrides the default method to refresh the ApplicationContext, invoking ConfigurableApplicationContext.refresh() . |
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(java.lang.String resourceLocation)
resourceLocation
- the Spring resource location to use
(either a URL or a "classpath:" / "classpath*:" pseudo URL)Method Detail |
---|
public static org.springframework.beans.factory.access.BeanFactoryLocator getInstance() throws org.springframework.beans.BeansException
getResources
method with this
name will be combined to create a definition, which is just a BeanFactory.
org.springframework.beans.BeansException
- in case of factory loading failurepublic static org.springframework.beans.factory.access.BeanFactoryLocator getInstance(java.lang.String selector) throws org.springframework.beans.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 location of the resource(s) which will be read and
combined to form the definition for the BeanFactoryLocator instance.
Any such files must form a valid ApplicationContext definition.
org.springframework.beans.BeansException
- in case of factory loading failureprotected org.springframework.beans.factory.BeanFactory createDefinition(java.lang.String resourceLocation, java.lang.String factoryKey)
The default implementation simply builds a
ClassPathXmlApplicationContext
.
createDefinition
in class org.springframework.beans.factory.access.SingletonBeanFactoryLocator
protected void initializeDefinition(org.springframework.beans.factory.BeanFactory groupDef)
ConfigurableApplicationContext.refresh()
.
initializeDefinition
in class org.springframework.beans.factory.access.SingletonBeanFactoryLocator
protected void destroyDefinition(org.springframework.beans.factory.BeanFactory groupDef, java.lang.String selector)
ConfigurableApplicationContext.close()
.
destroyDefinition
in class org.springframework.beans.factory.access.SingletonBeanFactoryLocator
|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |