|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.test.context.support.AbstractContextLoader org.springframework.test.context.support.AbstractGenericContextLoader
public abstract class AbstractGenericContextLoader
Abstract, generic extension of AbstractContextLoader
which loads a
GenericApplicationContext
from the locations provided to
loadContext(String...)
.
Concrete subclasses must provide an appropriate
BeanDefinitionReader
.
loadContext(String...)
Field Summary | |
---|---|
protected static Log |
logger
|
Constructor Summary | |
---|---|
AbstractGenericContextLoader()
|
Method Summary | |
---|---|
protected abstract BeanDefinitionReader |
createBeanDefinitionReader(GenericApplicationContext context)
Factory method for creating new BeanDefinitionReader s for
loading bean definitions into the supplied
context . |
protected void |
customizeBeanFactory(DefaultListableBeanFactory beanFactory)
Customize the internal bean factory of the ApplicationContext created by this ContextLoader. |
protected void |
customizeContext(GenericApplicationContext context)
Customize the GenericApplicationContext created by this ContextLoader
after bean definitions have been loaded into the context but
before the context is refreshed. |
ConfigurableApplicationContext |
loadContext(String... locations)
Loads a Spring ApplicationContext from the supplied locations . |
protected void |
prepareContext(GenericApplicationContext context)
Prepare the GenericApplicationContext created by this ContextLoader. |
Methods inherited from class org.springframework.test.context.support.AbstractContextLoader |
---|
generateDefaultLocations, getResourceSuffix, isGenerateDefaultLocations, modifyLocations, processLocations |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Log logger
Constructor Detail |
---|
public AbstractGenericContextLoader()
Method Detail |
---|
public final ConfigurableApplicationContext loadContext(String... locations) throws Exception
locations
.
Implementation details:
GenericApplicationContext
instance.BeanDefinitionReader
.customizeBeanFactory(DefaultListableBeanFactory)
to
allow for customizing the context's DefaultListableBeanFactory.AnnotationConfigUtils
for
registering
annotation configuration processors.customizeContext(GenericApplicationContext)
to allow
for customizing the context before it is refreshed.Refreshes
the
context and registers a JVM shutdown hook for it.Subclasses must provide an appropriate implementation of
createBeanDefinitionReader(GenericApplicationContext)
.
locations
- the resource locations to use to load the application context
Exception
- if context loading failedContextLoader.loadContext(java.lang.String...)
,
GenericApplicationContext
,
customizeBeanFactory(DefaultListableBeanFactory)
,
createBeanDefinitionReader(GenericApplicationContext)
,
BeanDefinitionReader
protected void prepareContext(GenericApplicationContext context)
GenericApplicationContext
created by this ContextLoader.
Called before> bean definitions are read.
The default implementation is empty. Can be overridden in subclasses to customize GenericApplicationContext's standard settings.
context
- the context for which the BeanDefinitionReader should be createdloadContext(java.lang.String...)
,
GenericApplicationContext.setResourceLoader(org.springframework.core.io.ResourceLoader)
,
AbstractApplicationContext.setId(java.lang.String)
protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory)
The default implementation is empty but can be overridden in subclasses to customize DefaultListableBeanFactory's standard settings.
beanFactory
- the bean factory created by this ContextLoaderloadContext(java.lang.String...)
,
DefaultListableBeanFactory.setAllowBeanDefinitionOverriding(boolean)
,
DefaultListableBeanFactory.setAllowEagerClassLoading(boolean)
,
AbstractAutowireCapableBeanFactory.setAllowCircularReferences(boolean)
,
AbstractAutowireCapableBeanFactory.setAllowRawInjectionDespiteWrapping(boolean)
protected abstract BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context)
BeanDefinitionReader
s for
loading bean definitions into the supplied
context
.
context
- the context for which the BeanDefinitionReader should be created
loadContext(java.lang.String...)
,
BeanDefinitionReader
protected void customizeContext(GenericApplicationContext context)
GenericApplicationContext
created by this ContextLoader
after bean definitions have been loaded into the context but
before the context is refreshed.
The default implementation is empty but can be overridden in subclasses to customize the application context.
context
- the newly created application contextloadContext(String...)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |