public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
AbstractGenericContextLoader that loads
 bean definitions from annotated classes.
 See the Javadoc for
 @ContextConfiguration
 for a definition of annotated class.
 
Note: AnnotationConfigContextLoader supports annotated classes
 rather than the String-based resource locations defined by the legacy
 ContextLoader API. Thus,
 although AnnotationConfigContextLoader extends
 AbstractGenericContextLoader, AnnotationConfigContextLoader
 does not support any String-based methods defined by
 AbstractContextLoader or AbstractGenericContextLoader.
 Consequently, AnnotationConfigContextLoader should chiefly be
 considered a SmartContextLoader
 rather than a ContextLoader.
| Constructor and Description | 
|---|
| AnnotationConfigContextLoader() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected BeanDefinitionReader | createBeanDefinitionReader(GenericApplicationContext context)AnnotationConfigContextLoadershould be used as aSmartContextLoader,
 not as a legacyContextLoader. | 
| protected Class<?>[] | detectDefaultConfigurationClasses(Class<?> declaringClass)Detect the default configuration classes for the supplied test class. | 
| protected String[] | generateDefaultLocations(Class<?> clazz)AnnotationConfigContextLoadershould be used as aSmartContextLoader,
 not as a legacyContextLoader. | 
| protected String | getResourceSuffix()AnnotationConfigContextLoadershould be used as aSmartContextLoader,
 not as a legacyContextLoader. | 
| protected void | loadBeanDefinitions(GenericApplicationContext context,
                   MergedContextConfiguration mergedConfig)Register classes in the supplied  contextfrom the classes in the suppliedMergedContextConfiguration. | 
| protected String[] | modifyLocations(Class<?> clazz,
               String... locations)AnnotationConfigContextLoadershould be used as aSmartContextLoader,
 not as a legacyContextLoader. | 
| void | processContextConfiguration(ContextConfigurationAttributes configAttributes)Process annotated classes in the supplied  ContextConfigurationAttributes. | 
| protected void | validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)Ensure that the supplied  MergedContextConfigurationdoes not
 containlocations. | 
customizeBeanFactory, customizeContext, loadContext, loadContext, prepareContextcustomizeContext, getResourceSuffixes, isGenerateDefaultLocations, prepareContext, processLocationspublic void processContextConfiguration(ContextConfigurationAttributes configAttributes)
ContextConfigurationAttributes.
 If the annotated classes are null or empty and
 AbstractContextLoader.isGenerateDefaultLocations() returns true, this
 SmartContextLoader will attempt to detect default configuration classes.
 If defaults are detected they will be
 set in the
 supplied configuration attributes. Otherwise, properties in the supplied
 configuration attributes will not be modified.
processContextConfiguration in interface SmartContextLoaderprocessContextConfiguration in class AbstractContextLoaderconfigAttributes - the context configuration attributes to processSmartContextLoader.processContextConfiguration(ContextConfigurationAttributes), 
AbstractContextLoader.isGenerateDefaultLocations(), 
detectDefaultConfigurationClasses(Class)protected Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass)
The default implementation simply delegates to
 AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(Class).
declaringClass - the test class that declared @ContextConfigurationnullAnnotationConfigContextLoaderUtilsprotected String[] modifyLocations(Class<?> clazz, String... locations)
AnnotationConfigContextLoader should be used as a
 SmartContextLoader,
 not as a legacy ContextLoader.
 Consequently, this method is not supported.modifyLocations in class AbstractContextLoaderclazz - the class with which the locations are associatedlocations - the resource locations to be modifiedUnsupportedOperationException - in this implementationAbstractContextLoader.modifyLocations(java.lang.Class<?>, java.lang.String...)protected String[] generateDefaultLocations(Class<?> clazz)
AnnotationConfigContextLoader should be used as a
 SmartContextLoader,
 not as a legacy ContextLoader.
 Consequently, this method is not supported.generateDefaultLocations in class AbstractContextLoaderclazz - the class for which the default locations are to be generatedUnsupportedOperationException - in this implementationAbstractContextLoader.generateDefaultLocations(java.lang.Class<?>)protected String getResourceSuffix()
AnnotationConfigContextLoader should be used as a
 SmartContextLoader,
 not as a legacy ContextLoader.
 Consequently, this method is not supported.getResourceSuffix in class AbstractContextLoadernull or emptyUnsupportedOperationException - in this implementationAbstractContextLoader.getResourceSuffix()protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)
MergedContextConfiguration does not
 contain locations.validateMergedContextConfiguration in class AbstractGenericContextLoadermergedConfig - the merged configuration to validateAbstractGenericContextLoader.validateMergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration)protected void loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig)
context
 from the classes in the supplied MergedContextConfiguration.
 Each class must represent an annotated class. An
 AnnotatedBeanDefinitionReader is used to register the appropriate
 bean definitions.
 
Note that this method does not call createBeanDefinitionReader(org.springframework.context.support.GenericApplicationContext)
 since AnnotatedBeanDefinitionReader is not an instance of
 BeanDefinitionReader.
loadBeanDefinitions in class AbstractGenericContextLoadercontext - the context in which the annotated classes should be registeredmergedConfig - the merged configuration from which the classes should be retrievedAbstractGenericContextLoader.loadBeanDefinitions(org.springframework.context.support.GenericApplicationContext, org.springframework.test.context.MergedContextConfiguration)protected BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context)
AnnotationConfigContextLoader should be used as a
 SmartContextLoader,
 not as a legacy ContextLoader.
 Consequently, this method is not supported.createBeanDefinitionReader in class AbstractGenericContextLoadercontext - the context for which the BeanDefinitionReader
 should be createdBeanDefinitionReader for the supplied contextUnsupportedOperationException - in this implementationloadBeanDefinitions(org.springframework.context.support.GenericApplicationContext, org.springframework.test.context.MergedContextConfiguration), 
AbstractGenericContextLoader.createBeanDefinitionReader(org.springframework.context.support.GenericApplicationContext)