public interface CacheAwareContextLoaderDelegate
CacheAwareContextLoaderDelegateis responsible for loading and closing application contexts, interacting transparently with a
ContextCachebehind the scenes.
|Modifier and Type||Method and Description|
ApplicationContext loadContext(MergedContextConfiguration mergedContextConfiguration)
MergedContextConfigurationby delegating to the
ContextLoaderconfigured in the given
If the context is present in the
ContextCache it will simply
be returned; otherwise, it will be loaded, stored in the cache, and returned.
The cache statistics should be logged by invoking
mergedContextConfiguration- the merged context configuration to use to load the application context; never
java.lang.IllegalStateException- if an error occurs while retrieving or loading the application context
void closeContext(MergedContextConfiguration mergedContextConfiguration, @Nullable DirtiesContext.HierarchyMode hierarchyMode)
ContextCacheand close it if it is an instance of
The semantics of the supplied
HierarchyMode must be honored when
removing the context from the cache. See the Javadoc for
Generally speaking, this method should only be called if the state of a singleton bean has been changed (potentially affecting future interaction with the context) or if the context needs to be prematurely removed from the cache.
mergedContextConfiguration- the merged context configuration for the application context to close; never
hierarchyMode- the hierarchy mode; may be
nullif the context is not part of a hierarchy