Annotation Interface AcrossWebAppConfiguration


@Documented @Inherited @Retention(RUNTIME) @Target(TYPE) @WebAppConfiguration @ContextConfiguration(initializers=MockAcrossServletContextInitializer.class) public @interface AcrossWebAppConfiguration
Custom annotation that extends the default 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

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<?>[]
    The annotated classes to use for loading an ApplicationContext.
    Class<? extends org.springframework.test.context.ContextLoader>
    The type of SmartContextLoader (or ContextLoader) to use for loading an ApplicationContext.
    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 resourcePath
      The 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<?>[] classes
      The annotated classes to use for loading an ApplicationContext.

      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 for loader() for further details regarding default loaders.

      Since:
      3.1
      See Also:
      • Configuration
      • AnnotationConfigContextLoader
      Default:
      {}
    • loader

      Class<? extends org.springframework.test.context.ContextLoader> loader
      The type of SmartContextLoader (or ContextLoader) to use for loading an ApplicationContext.

      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 or WebDelegatingSmartContextLoader depending on the absence or presence of org.springframework.test.context.web.WebAppConfiguration. For further details on the default behavior of various concrete SmartContextLoaders, check out the Javadoc for AbstractContextLoader, GenericXmlContextLoader, GenericGroovyXmlContextLoader, AnnotationConfigContextLoader, GenericXmlWebContextLoader, GenericGroovyXmlWebContextLoader, and AnnotationConfigWebContextLoader.

      Since:
      2.5
      Default:
      org.springframework.test.context.ContextLoader.class