Interface SmartContextLoader

All Superinterfaces:
ContextLoader
All Known Subinterfaces:
AotContextLoader
All Known Implementing Classes:
AbstractContextLoader, AbstractDelegatingSmartContextLoader, AbstractGenericContextLoader, AbstractGenericWebContextLoader, AnnotationConfigContextLoader, AnnotationConfigWebContextLoader, DelegatingSmartContextLoader, GenericGroovyXmlContextLoader, GenericGroovyXmlWebContextLoader, GenericXmlContextLoader, GenericXmlWebContextLoader, WebDelegatingSmartContextLoader

public interface SmartContextLoader extends ContextLoader
Strategy interface for loading an ApplicationContext for an integration test managed by the Spring TestContext Framework.

The SmartContextLoader SPI supersedes the ContextLoader SPI introduced in Spring 2.5: a SmartContextLoader can choose to process resource locations, component classes, or a combination of both. Furthermore, a SmartContextLoader can configure the context that it loads based on any properties available in the provided MergedContextConfiguration. For example, active bean definition profiles can be configured for the context based on MergedContextConfiguration.getActiveProfiles().

See the Javadoc for @ContextConfiguration for a definition of component classes.

Clients of a SmartContextLoader should call processContextConfiguration() prior to calling loadContext(). This gives a SmartContextLoader the opportunity to provide custom support for modifying resource locations or detecting default resource locations or default configuration classes. The results of processContextConfiguration() should be merged for all classes in the hierarchy of the root test class and then supplied to loadContext().

NOTE: As of Spring Framework 6.0, SmartContextLoader no longer supports methods defined in the ContextLoader SPI.

Concrete implementations must provide a public no-args constructor.

Spring provides the following SmartContextLoader implementations.

Since:
3.1
Author:
Sam Brannen
See Also: