in-memory embedded database가 설정되어 테스트를 위한 JdbcTemplate 이 생성된다.
일반적인 @ConfigurationProperties 와 @Component 빈들은 스캔되지 않는다.
각 테스트마다 DB 가 ROLLBACK 된다.
@JdbcTest
@Transactional(propagation = Propagation.NOT_SUPPORTED)
class MyTransactionalTests {
}
Annotation for a JDBC test that focuses only on JDBC-based components.
Using this annotation will disable full auto-configuration and instead
apply only configuration relevant to JDBC tests.
By default, tests annotated with @JdbcTest are transactional and roll back
at the end of each test. They also use an embedded in-memory database
(replacing any explicit or usually auto-configured DataSource).
The @AutoConfigureTestDatabase annotation can be used to override these settings.
If you are looking to load your full application configuration,
but use an embedded database, you should consider @SpringBootTest combined
with @AutoConfigureTestDatabase rather than this annotation.
When using JUnit 4, this annotation should be used in combination
with @RunWith(SpringRunner.class).
Since:
1.5.0
See Also:
AutoConfigureJdbc, AutoConfigureTestDatabase, AutoConfigureCache
Author:
Stephane Nicoll, Artsiom Yudovin
Annotation for a JDBC test that focuses only on JDBC-based components.
JDBC 에 기반한 component 만을 사용한 JDBC 테스트를 위한 어노테이션이다.
By default, tests annotated with @JdbcTest are transactional and roll back at the end of each test.
@JdbcTest 를 붙인 테스트는 매 테스트가 종료될 때마다 데이터베이스를 ROLLBACK 시킨다.
They also use an embedded in-memory database (replacing any explicit or usually auto-configured DataSource).
또한 in-memory DB 를 사용한다. (h2 DataBase) -> 테스트를 위한 JdbcTemplate 이 생성된다.