| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.test.context.support.AbstractContextLoader
public abstract class AbstractContextLoader
Abstract application context loader, which provides a basis for all concrete
 implementations of the ContextLoader strategy. Provides a
 Template Method based approach for processing
 locations.
generateDefaultLocations(java.lang.Class>), 
modifyLocations(java.lang.Class>, java.lang.String...)| Constructor Summary | |
|---|---|
| AbstractContextLoader() | |
| Method Summary | |
|---|---|
| protected  String[] | generateDefaultLocations(Class<?> clazz)Generates the default classpath resource locations array based on the supplied class. | 
| protected abstract  String | getResourceSuffix()Get the suffix to append to ApplicationContextresource
 locations when generating default locations. | 
| protected  boolean | isGenerateDefaultLocations()Determine whether or not default resource locations should be generated if the locationsprovided toprocessLocations()arenullor empty. | 
| protected  String[] | modifyLocations(Class<?> clazz,
                String... locations)Generate a modified version of the supplied locations array and returns it. | 
|  String[] | processLocations(Class<?> clazz,
                 String... locations)If the supplied locationsarenullor
 empty andisGenerateDefaultLocations()istrue, default locations will begeneratedfor the specifiedclassand the configuredresource suffix; otherwise, the suppliedlocationswill bemodifiedif
 necessary and returned. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface org.springframework.test.context.ContextLoader | 
|---|
| loadContext | 
| Constructor Detail | 
|---|
public AbstractContextLoader()
| Method Detail | 
|---|
public final String[] processLocations(Class<?> clazz,
                                       String... locations)
locations are null or
 empty and isGenerateDefaultLocations() is
 true, default locations will be
 generated for the specified
 class and the configured
 resource suffix; otherwise, the supplied
 locations will be modified if
 necessary and returned.
processLocations in interface ContextLoaderclazz - the class with which the locations are associated: to be
 used when generating default locationslocations - the unmodified locations to use for loading the
 application context (can be null or empty)
generateDefaultLocations(java.lang.Class>), 
modifyLocations(java.lang.Class>, java.lang.String...), 
ContextLoader.processLocations(java.lang.Class>, java.lang.String...)protected String[] generateDefaultLocations(Class<?> clazz)
For example, if the supplied class is com.example.MyTest,
 the generated locations will contain a single string with a value of
 "classpath:/com/example/MyTest<suffix>",
 where <suffix> is the value of the
 resource suffix string.
 
Subclasses can override this method to implement a different default location generation strategy.
clazz - the class for which the default locations are to be generated
getResourceSuffix()
protected String[] modifyLocations(Class<?> clazz,
                                   String... locations)
A plain path, e.g. "context.xml", will be treated as a
 classpath resource from the same package in which the specified class is
 defined. A path starting with a slash is treated as a fully qualified
 class path location, e.g.:
 "/org/springframework/whatever/foo.xml". A path which
 references a URL (e.g., a path prefixed with
 classpath:,
 file:, http:,
 etc.) will be added to the results unchanged.
 
Subclasses can override this method to implement a different location modification strategy.
clazz - the class with which the locations are associatedlocations - the resource locations to be modified
protected boolean isGenerateDefaultLocations()
locations provided to
 processLocations() are
 null or empty.
 Can be overridden by subclasses to change the default behavior.
true by defaultprotected abstract String getResourceSuffix()
ApplicationContext resource
 locations when generating default locations.
 Must be implemented by subclasses.
null or emptygenerateDefaultLocations(Class)| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||