public class ApplicationContextManager extends AnnotatedInstanceManager<org.springframework.context.ApplicationContext,SpringApplicationContext>
| Modifier and Type | Field and Description |
|---|---|
protected ApplicationContextFactory |
applicationContextFactory
Factory for creating ApplicationContexts
|
annotationClass, instanceClass, instances| Constructor and Description |
|---|
ApplicationContextManager(ApplicationContextFactory applicationContextFactory)
Creates a new instance, using the given
ApplicationContextFactory. |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.context.ApplicationContext |
createInstanceForValues(Object testObject,
Class<?> testClass,
List<String> locations)
Creates a new application context for the given locations.
|
protected List<String> |
getAnnotationValues(SpringApplicationContext annotation)
Gets the locations that are specified for the given
SpringApplicationContext annotation. |
org.springframework.context.ApplicationContext |
getApplicationContext(Object testObject)
Gets the application context for the given test as described in the class javadoc.
|
boolean |
hasApplicationContext(Object testObject)
Checks whether the given test object has an application context linked to it.
|
void |
invalidateApplicationContext(Class<?>... classes)
Forces the reloading of the application context the next time that it is requested.
|
afterInstanceCreate, createCustomCreatedInstance, createCustomCreatedInstanceFromCustomCreateMethodResult, getAnnotationValues, getCustomCreateMethod, getCustomCreateMethodReturnType, getInstance, getInstanceImpl, hasInstance, hasInstanceImpl, invalidateInstance, invokeCustomCreateMethod, isCustomCreateMethod, registerInstanceprotected ApplicationContextFactory applicationContextFactory
public ApplicationContextManager(ApplicationContextFactory applicationContextFactory)
ApplicationContextFactory. The given list of
BeanPostProcessors will be registered on all ApplicationContexts that are
created.applicationContextFactory - The factory for creating ApplicationContexts, not null.public org.springframework.context.ApplicationContext getApplicationContext(Object testObject)
testObject - The test instance, not nullpublic boolean hasApplicationContext(Object testObject)
getApplicationContext(java.lang.Object) will return an application context, If false is returned, it will raise
an exception.testObject - The test instance, not nullpublic void invalidateApplicationContext(Class<?>... classes)
classes - The classes for which to reset the contextsprotected org.springframework.context.ApplicationContext createInstanceForValues(Object testObject, Class<?> testClass, List<String> locations)
BeanPostProcessors and
refresh the context.
Note: for this to work, the application context may not have been refreshed in the factory.
By registering the bean post processors before the refresh, we can intercept bean creation and bean wiring.
This is no longer possible if the context is already refreshed.createInstanceForValues in class AnnotatedInstanceManager<org.springframework.context.ApplicationContext,SpringApplicationContext>locations - The locations where to find configuration files, not nullprotected List<String> getAnnotationValues(SpringApplicationContext annotation)
SpringApplicationContext annotation. An array with
1 empty string should be considered to be empty and null should be returned.getAnnotationValues in class AnnotatedInstanceManager<org.springframework.context.ApplicationContext,SpringApplicationContext>annotation - The annotation, not nullCopyright © 2016. All Rights Reserved.