Annotation Interface AcrossWebAppConfiguration
WebAppConfiguration
with adding an initializer that ensures a MockAcrossServletContext
is set
on the WebApplicationContext
.
When used in conjunction with AcrossTestConfiguration
this will provide an initialized
MockMvc
bean that has all dynamically registered filters.
The combination of AcrossWebAppConfiguration
and
AcrossTestConfiguration
is a common setup for integration testing of Across modules.
This annotation has aliases for ContextConfiguration
classes()
and
loader()
. If you need more advanced customization
you should revert to the manual combination of the annotations and adding the
MockAcrossServletContextInitializer
.
- Since:
- 1.1.2
- Author:
- Arne Vandamme
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionClass<?>[]
The annotated classes to use for loading anApplicationContext
.Class<? extends org.springframework.test.context.ContextLoader>
The type ofSmartContextLoader
(orContextLoader
) to use for loading anApplicationContext
.The resource path to the root directory of the web application.
-
Element Details
-
resourcePath
@AliasFor(annotation=org.springframework.test.context.web.WebAppConfiguration.class, value="value") String resourcePathThe resource path to the root directory of the web application.A path that does not include a Spring resource prefix (e.g.,
classpath:
,file:
, etc.) will be interpreted as a file system resource, and a path should not end with a slash.Defaults to
"classpath:"
, note that the standard directory for the root of a web application in a Maven WAR layout usually is"src/main/webapp"
.- Default:
- "classpath:"
-
classes
Class<?>[] classesThe annotated classes to use for loading anApplicationContext
.Check out the javadoc for
AnnotationConfigContextLoader.detectDefaultConfigurationClasses()
for details on how default configuration classes will be detected if no annotated classes are specified. See the documentation forloader()
for further details regarding default loaders.- Since:
- 3.1
- See Also:
-
Configuration
AnnotationConfigContextLoader
- Default:
- {}
-
loader
Class<? extends org.springframework.test.context.ContextLoader> loaderThe type ofSmartContextLoader
(orContextLoader
) to use for loading anApplicationContext
.If not specified, the loader will be inherited from the first superclass that is annotated with
@ContextConfiguration
and specifies an explicit loader. If no class in the hierarchy specifies an explicit loader, a default loader will be used instead.The default concrete implementation chosen at runtime will be either
DelegatingSmartContextLoader
orWebDelegatingSmartContextLoader
depending on the absence or presence oforg.springframework.test.context.web.WebAppConfiguration
. For further details on the default behavior of various concreteSmartContextLoaders
, check out the Javadoc forAbstractContextLoader
,GenericXmlContextLoader
,GenericGroovyXmlContextLoader
,AnnotationConfigContextLoader
,GenericXmlWebContextLoader
,GenericGroovyXmlWebContextLoader
, andAnnotationConfigWebContextLoader
.- Since:
- 2.5
- Default:
- org.springframework.test.context.ContextLoader.class
-