public abstract class AbstractGenericContextLoader
extends org.springframework.test.context.support.AbstractContextLoader
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
AbstractGenericContextLoader() |
Modifier and Type | Method and Description |
---|---|
protected abstract org.springframework.beans.factory.support.BeanDefinitionReader |
createBeanDefinitionReader(org.springframework.context.support.GenericApplicationContext context)
Factory method for creating new
BeanDefinitionReader s for
loading bean definitions into the supplied
context . |
protected void |
customizeBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
Customize the internal bean factory of the ApplicationContext created by
this ContextLoader.
|
protected void |
customizeContext(org.springframework.context.support.GenericApplicationContext context)
Customize the
GenericApplicationContext created by this ContextLoader
after bean definitions have been loaded into the context but
before the context is refreshed. |
org.springframework.context.ConfigurableApplicationContext |
loadContext(String... locations)
Loads a Spring ApplicationContext from the supplied
locations . |
protected void |
postRefresh(org.springframework.context.support.GenericApplicationContext context) |
protected void |
prepareContext(org.springframework.context.support.GenericApplicationContext context)
Prepare the
GenericApplicationContext created by this ContextLoader. |
customizeContext, generateDefaultLocations, getResourceSuffix, getResourceSuffixes, isGenerateDefaultLocations, modifyLocations, prepareContext, processContextConfiguration, processLocations
public final org.springframework.context.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)
.
Exception
ContextLoader.loadContext(java.lang.String...)
,
GenericApplicationContext
,
customizeBeanFactory(DefaultListableBeanFactory)
,
createBeanDefinitionReader(GenericApplicationContext)
,
BeanDefinitionReader
protected void postRefresh(org.springframework.context.support.GenericApplicationContext context)
protected void prepareContext(org.springframework.context.support.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(org.springframework.beans.factory.support.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 org.springframework.beans.factory.support.BeanDefinitionReader createBeanDefinitionReader(org.springframework.context.support.GenericApplicationContext context)
BeanDefinitionReader
s for
loading bean definitions into the supplied
context
.context
- the context for which the BeanDefinitionReader should be createdloadContext(java.lang.String...)
,
BeanDefinitionReader
protected void customizeContext(org.springframework.context.support.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...)
Copyright © 2006–2018 TinyGroup. All rights reserved.