|
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 . |
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
Loads a Spring ApplicationContext from the supplied
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 customizeBeanFactory(DefaultListableBeanFactory beanFactory)
Customize the internal bean factory of the ApplicationContext created by this ContextLoader.
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(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(String...)
,
BeanDefinitionReader
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.
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 |