Annotation Interface EmbeddedTomcatConfiguration


@Target(TYPE) @Retention(RUNTIME) @Documented @Inherited @ExtendWith(org.springframework.test.context.junit.jupiter.SpringExtension.class) @BootstrapWith(io.microsphere.spring.test.tomcat.embedded.EmbeddedTomcatTestContextBootstrapper.class) @ContextConfiguration @WebAppConfiguration public @interface EmbeddedTomcatConfiguration
The annotation to startup the Embedded Tomcat server for Spring integration testing.
Since:
1.0.0
Author:
Mercy
See Also:
  • Tomcat
  • Context
  • Element Details

    • port

      int port
      The port of Tomcat
      Returns:
      the default value of port : 8080
      Default:
      8080
    • contextPath

      String contextPath
      The context path of Tomcat
      Returns:
      the default value of context path : ""
      See Also:
      • Context.setPath(String)
      Default:
      ""
    • basedir

      String basedir
      The resource location of the Tomcat's base directory.

      The value supports two types of locations:

      • File System, e.g: /tmp/catalina
      • Spring Resource location, e.g: classpath:/catalina, file:/temp/catalina
      Returns:
      the default value of basedir : The "java.io.tmpdir" system property (the directory where Java temporary directory) where a directory named tomcat.$PORT will be created. $PORT is the value configured via Tomcat.setPort(int) which defaults to 8080 if not set
      See Also:
      • Tomcat.setBaseDir(String)
      Default:
      "${java.io.tmpdir}"
    • docBase

      @AliasFor(annotation=org.springframework.test.context.web.WebAppConfiguration.class, attribute="value") String docBase
      The resource location of the Tomcat's the root directory of context document.

      The value supports two types of locations:

      • File System, e.g: /tmp/webapp
      • Spring Resource location, e.g: classpath:/WEB-INF/webapp, file:/temp/webapp

      Alias for WebAppConfiguration.value().

      Note : docBase() could be ignored if alternativeWebXml() is specified.

      Returns:
      the default value : "classpath:/webapp"
      See Also:
      • Context.setDocBase(String)
      Default:
      "classpath:/webapp"
    • alternativeWebXml

      String alternativeWebXml
      The resource location of an alternative deployment descriptor for the web application.

      The value supports two types of locations:

      • File System, e.g: /tmp/web.xml
      • Spring Resource location, e.g: classpath:/WEB-INF/web.xml, file:/temp/web.xml

      Note : Whether the location is based on File System or Spring Resource, Tomcat only uses the deployment descriptor whose underlying layer resource must be the file, please reference to the Tomcat's source code.

      If alternativeWebXml() is specified, docBase() will be ignored, and the context's document base will be the parent directory of the alternative deployment descriptor.

      Returns:
      the default value is "", which means no alternative deployment descriptor required.
      See Also:
      • Context.setAltDDName(String)
      Default:
      ""
    • features

      Enable the Tomcat features
      Returns:
      the empty array as default
      Default:
      {}
    • classes

      @AliasFor(annotation=org.springframework.test.context.ContextConfiguration.class) Class<?>[] classes
      The component classes to use for loading an ApplicationContext.

      Alias for ContextConfiguration.classes().

      Default:
      {}
    • locations

      @AliasFor(annotation=org.springframework.test.context.ContextConfiguration.class) String[] locations
      The resource locations to use for loading an ApplicationContext.

      Alias for ContextConfiguration.locations().

      Default:
      {}
    • initializers

      @AliasFor(annotation=org.springframework.test.context.ContextConfiguration.class) Class<? extends org.springframework.context.ApplicationContextInitializer<?>>[] initializers
      The application context initializer classes to use for initializing a ConfigurableApplicationContext.

      Alias for ContextConfiguration.initializers().

      Default:
      {}
    • inheritLocations

      @AliasFor(annotation=org.springframework.test.context.ContextConfiguration.class) boolean inheritLocations
      Whether resource locations or component classes from test superclasses and enclosing classes should be inherited.

      Alias for ContextConfiguration.inheritLocations().

      Default:
      true
    • inheritInitializers

      @AliasFor(annotation=org.springframework.test.context.ContextConfiguration.class) boolean inheritInitializers
      Whether context initializers from test superclasses and enclosing classes should be inherited.

      Alias for ContextConfiguration.inheritInitializers().

      Default:
      true