Annotation Interface AutoConfigureTestDatabase


@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented @Inherited @ImportAutoConfiguration @PropertyMapping("spring.test.database") public @interface AutoConfigureTestDatabase
Annotation that can be applied to a test class to configure a test database to use instead of the application-defined or auto-configured DataSource. In the case of multiple DataSource beans, only the @Primary DataSource is considered.
Since:
1.5.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    What the test database can replace.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    org.springframework.boot.jdbc.EmbeddedDatabaseConnection
    The type of connection to be established when replacing the DataSource.
    Determines what type of existing DataSource bean can be replaced.
  • Element Details

    • replace

      Determines what type of existing DataSource bean can be replaced.
      Returns:
      the type of existing DataSource to replace
      Default:
      ANY
    • connection

      org.springframework.boot.jdbc.EmbeddedDatabaseConnection connection
      The type of connection to be established when replacing the DataSource. By default will attempt to detect the connection based on the classpath.
      Returns:
      the type of connection to use
      Default:
      NONE