From 5903e9a57a68a18f61b0ba335c11707a0a63aaeb Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 19 Jul 2019 10:16:34 +0200 Subject: [PATCH] Polish --- .../test/autoconfigure/data/jdbc/DataJdbcTest.java | 13 ++++++++++++- .../boot/test/autoconfigure/jdbc/JdbcTest.java | 7 ++++--- .../test/autoconfigure/orm/jpa/DataJpaTest.java | 7 ++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/jdbc/DataJdbcTest.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/jdbc/DataJdbcTest.java index 63941f28076..9c553647a0a 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/jdbc/DataJdbcTest.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/jdbc/DataJdbcTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.core.AutoConfigureCache; import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.core.annotation.AliasFor; import org.springframework.core.env.Environment; @@ -44,6 +45,16 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; *

* Using this annotation will disable full auto-configuration and instead apply only * configuration relevant to Data JDBC tests. + *

+ * By default, tests annotated with {@code @DataJdbcTest} will use an embedded in-memory + * database (replacing any explicit or usually auto-configured DataSource). The + * {@link AutoConfigureTestDatabase @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 {@link SpringBootTest @SpringBootTest} combined with + * {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} rather than this + * annotation. * * @author Andy Wilkinson * @since 2.1.0 diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/jdbc/JdbcTest.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/jdbc/JdbcTest.java index c6cdaca25e4..ff055ef71d0 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/jdbc/JdbcTest.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/jdbc/JdbcTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,8 +46,9 @@ import org.springframework.transaction.annotation.Transactional; * Using this annotation will disable full auto-configuration and instead apply only * configuration relevant to jdbc tests. *

- * By default, tests annotated with {@code @JdbcTest} will use an embedded in-memory - * database (replacing any explicit or usually auto-configured DataSource). The + * By default, tests annotated with {@code @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 * {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} annotation can be used to * override these settings. *

diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java index f07fca0f71f..e9e2961a5b9 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,8 +48,9 @@ import org.springframework.transaction.annotation.Transactional; * Using this annotation will disable full auto-configuration and instead apply only * configuration relevant to JPA tests. *

- * By default, tests annotated with {@code @DataJpaTest} will use an embedded in-memory - * database (replacing any explicit or usually auto-configured DataSource). The + * By default, tests annotated with {@code @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 * {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} annotation can be used to * override these settings. *