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
- Author:
- Phillip Webb
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
What the test database can replace. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe type of connection to be established whenreplacing
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:
- NON_TEST
-
connection
EmbeddedDatabaseConnection connectionThe type of connection to be established whenreplacing
the DataSource. By default, will attempt to detect the connection based on the classpath.- Returns:
- the type of connection to use
- Default:
- NONE
-