Interface SmartContextLoader

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

public interface SmartContextLoader extends ContextLoader
Strategy interface for loading an application context 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 either resource locations or annotated classes. Furthermore, a SmartContextLoader can set active bean definition profiles in the context that it loads (see MergedContextConfiguration.getActiveProfiles() and loadContext(MergedContextConfiguration)).

See the Javadoc for @ContextConfiguration for a definition of annotated class.

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().

Even though SmartContextLoader extends ContextLoader, clients should favor SmartContextLoader-specific methods over those defined in ContextLoader, particularly because a SmartContextLoader may choose not to support methods defined in the ContextLoader SPI.

Concrete implementations must provide a public no-args constructor.

Spring provides the following out-of-the-box implementations:

Since:
3.1
Author:
Sam Brannen
See Also: