Interface ContextLoader
- All Known Subinterfaces:
- AotContextLoader,- SmartContextLoader
- All Known Implementing Classes:
- AbstractContextLoader,- AbstractDelegatingSmartContextLoader,- AbstractGenericContextLoader,- AbstractGenericWebContextLoader,- AnnotationConfigContextLoader,- AnnotationConfigWebContextLoader,- DelegatingSmartContextLoader,- GenericGroovyXmlContextLoader,- GenericGroovyXmlWebContextLoader,- GenericXmlContextLoader,- GenericXmlWebContextLoader,- WebDelegatingSmartContextLoader
ApplicationContext for an integration
 test managed by the Spring TestContext Framework.
 NOTE: as of Spring Framework 6.0, ContextLoader is
 effectively a marker interface and should not be implemented directly. Implement
 SmartContextLoader instead of this interface in order to provide support
 for annotated classes, active bean definition profiles, application context
 initializers, and various other features not supported by methods defined in
 the ContextLoader SPI.
 
Clients of a ContextLoader should call
 processLocations() prior to
 calling loadContext() in case the
 ContextLoader provides custom support for modifying or generating locations.
 The results of processLocations()
 should then be supplied to loadContext().
 
Concrete implementations must provide a public no-args constructor.
- Since:
- 2.5
- Author:
- Sam Brannen, Juergen Hoeller
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionloadContext(String... locations) Deprecated.String[]processLocations(Class<?> clazz, String... locations) Deprecated.as of Spring Framework 6.0, in favor of methods defined in theSmartContextLoaderSPI
- 
Method Details- 
processLocationsDeprecated.as of Spring Framework 6.0, in favor of methods defined in theSmartContextLoaderSPIProcesses application context resource locations for a specified class.Concrete implementations may choose to modify the supplied locations, generate new locations, or simply return the supplied locations unchanged. - Parameters:
- clazz- the class with which the locations are associated: used to determine how to process the supplied locations
- locations- the unmodified locations to use for loading the application context (can be- nullor empty)
- Returns:
- an array of application context resource locations
 
- 
loadContextDeprecated.as of Spring Framework 6.0, in favor of methods defined in theSmartContextLoaderSPILoads a newApplicationContextbased on the suppliedlocations, configures the context, and finally returns the context in fully refreshed state.Configuration locations are generally considered to be classpath resources by default. Concrete implementations should register annotation configuration processors with bean factories of application contexts loaded by this ContextLoader. Beans will therefore automatically be candidates for annotation-based dependency injection using@Autowired,@Resource, and@Inject.Any ApplicationContextloaded by aContextLoadermust register a JVM shutdown hook for itself. Unless the context gets closed early, all context instances will be automatically closed on JVM shutdown. This allows for freeing external resources held by beans within the context, e.g. temporary files.- Parameters:
- locations- the resource locations to use to load the application context
- Returns:
- a new application context
- Throws:
- Exception- if context loading failed
 
 
- 
SmartContextLoaderSPI