Using this annotation will disable full auto-configuration and instead apply only configuration relevant to JPA tests.
By default, tests annotated with @DataJpaTest
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.
SQL queries are logged by default by setting the spring.jpa.show-sql
property
to true
. This can be disabled using the showSql
attribute.
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)