spring-framework / org.springframework.test.context.web / AnnotationConfigWebContextLoader

AnnotationConfigWebContextLoader

open class AnnotationConfigWebContextLoader : AbstractGenericWebContextLoader

Concrete implementation of AbstractGenericWebContextLoader that loads bean definitions from annotated classes.

See the Javadoc for org.springframework.test.context.ContextConfiguration for a definition of annotated class.

Note: AnnotationConfigWebContextLoader supports annotated classes rather than the String-based resource locations defined by the legacy org.springframework.test.context.ContextLoader API. Thus, although AnnotationConfigWebContextLoader extends AbstractGenericWebContextLoader, AnnotationConfigWebContextLoader does not support any String-based methods defined by org.springframework.test.context.support.AbstractContextLoader or AbstractGenericWebContextLoader. Consequently, AnnotationConfigWebContextLoader should chiefly be considered a org.springframework.test.context.SmartContextLoader rather than a org.springframework.test.context.ContextLoader.

Author
Sam Brannen

Since
3.2

See Also
#processContextConfiguration(ContextConfigurationAttributes)#detectDefaultConfigurationClasses(Class)#loadBeanDefinitions(GenericWebApplicationContext, WebMergedContextConfiguration)GenericXmlWebContextLoaderGenericGroovyXmlWebContextLoader

Constructors

<init>

AnnotationConfigWebContextLoader()

Concrete implementation of AbstractGenericWebContextLoader that loads bean definitions from annotated classes.

See the Javadoc for org.springframework.test.context.ContextConfiguration for a definition of annotated class.

Note: AnnotationConfigWebContextLoader supports annotated classes rather than the String-based resource locations defined by the legacy org.springframework.test.context.ContextLoader API. Thus, although AnnotationConfigWebContextLoader extends AbstractGenericWebContextLoader, AnnotationConfigWebContextLoader does not support any String-based methods defined by org.springframework.test.context.support.AbstractContextLoader or AbstractGenericWebContextLoader. Consequently, AnnotationConfigWebContextLoader should chiefly be considered a org.springframework.test.context.SmartContextLoader rather than a org.springframework.test.context.ContextLoader.

Functions

processContextConfiguration

open fun processContextConfiguration(configAttributes: ContextConfigurationAttributes): Unit

Process annotated classes in the supplied ContextConfigurationAttributes.

If the annotated classes are null or empty and #isGenerateDefaultLocations() returns true, this SmartContextLoader will attempt to . If defaults are detected they will be set in the supplied configuration attributes. Otherwise, properties in the supplied configuration attributes will not be modified.