Commit fd6ad5b8 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '2.3.x' into 2.4.x

Closes gh-26024
parents b2d167c1 7286c33f
...@@ -7522,6 +7522,9 @@ The following example shows a typical setup for using Cassandra tests in Spring ...@@ -7522,6 +7522,9 @@ The following example shows a typical setup for using Cassandra tests in Spring
You can use the `@DataJpaTest` annotation to test JPA applications. You can use the `@DataJpaTest` annotation to test JPA applications.
By default, it scans for `@Entity` classes and configures Spring Data JPA repositories. By default, it scans for `@Entity` classes and configures Spring Data JPA repositories.
If an embedded database is available on the classpath, it configures one as well. If an embedded database is available on the classpath, it configures one as well.
SQL queries are logged by default by setting the `spring.jpa.show-sql` property to `true`.
This can be disabled using the `showSql()` attribute of the annotation.
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataJpaTest` annotation is used. Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataJpaTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans. `@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
......
...@@ -53,6 +53,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -53,6 +53,10 @@ import org.springframework.transaction.annotation.Transactional;
* {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} annotation can be used to * {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} annotation can be used to
* override these settings. * override these settings.
* <p> * <p>
* SQL queries are logged by default by setting the {@code spring.jpa.show-sql} property
* to {@code true}. This can be disabled using the {@link DataJpaTest#showSql() showSql}
* attribute.
* <p>
* If you are looking to load your full application configuration, but use an embedded * If you are looking to load your full application configuration, but use an embedded
* database, you should consider {@link SpringBootTest @SpringBootTest} combined with * database, you should consider {@link SpringBootTest @SpringBootTest} combined with
* {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} rather than this * {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} rather than this
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment