Annotation Interface WebAppConfiguration


@Target(TYPE) @Retention(RUNTIME) @Documented @Inherited public @interface WebAppConfiguration
@WebAppConfiguration is a class-level annotation that is used to declare that the ApplicationContext loaded for an integration test should be a WebApplicationContext.

The presence of @WebAppConfiguration on a test class indicates that a WebApplicationContext should be loaded for the test using a default for the path to the root of the web application. To override the default, specify an explicit resource path via the value() attribute.

Note that @WebAppConfiguration must be used in conjunction with @ContextConfiguration, either within a single test class or within a test class hierarchy.

This annotation may be used as a meta-annotation to create custom composed annotations.

this annotation will be inherited from an enclosing test class by default. See @NestedTestConfiguration for details.

从以下版本开始:
4.0
作者:
Sam Brannen
另请参阅:
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    The resource path to the root directory of the web application.
  • 元素详细资料

    • value

      String value
      The resource path to the root directory of the web application.

      A path that does not include a Infra 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 "src/main/webapp" as a file system resource. Note that this is the standard directory for the root of a web application in a project that follows the standard Maven project layout for a WAR.

      默认值:
      "src/main/webapp"