Skip to content

Commit dd02404

Browse files
committed
Merge branch '2.3.x'
Closes gh-23244
2 parents 8daf57f + aab4ee9 commit dd02404

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6856,7 +6856,8 @@ assertThat(json.write(message))
68566856
==== Auto-configured Spring MVC Tests
68576857
To test whether Spring MVC controllers are working as expected, use the `@WebMvcTest` annotation.
68586858
`@WebMvcTest` auto-configures the Spring MVC infrastructure and limits scanned beans to `@Controller`, `@ControllerAdvice`, `@JsonComponent`, `Converter`, `GenericConverter`, `Filter`, `HandlerInterceptor`, `WebMvcConfigurer`, and `HandlerMethodArgumentResolver`.
6859-
Regular `@Component` beans are not scanned when using this annotation.
6859+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@WebMvcTest` annotation is used.
6860+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
68606861

68616862
TIP: A list of the auto-configuration settings that are enabled by `@WebMvcTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
68626863

@@ -6956,7 +6957,8 @@ TIP: Sometimes writing Spring MVC tests is not enough; Spring Boot can help you
69566957
==== Auto-configured Spring WebFlux Tests
69576958
To test that {spring-framework-docs}/web-reactive.html[Spring WebFlux] controllers are working as expected, you can use the `@WebFluxTest` annotation.
69586959
`@WebFluxTest` auto-configures the Spring WebFlux infrastructure and limits scanned beans to `@Controller`, `@ControllerAdvice`, `@JsonComponent`, `Converter`, `GenericConverter`, `WebFilter`, and `WebFluxConfigurer`.
6959-
Regular `@Component` beans are not scanned when the `@WebFluxTest` annotation is used.
6960+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@WebFluxTest` annotation is used.
6961+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
69606962

69616963
TIP: A list of the auto-configurations that are enabled by `@WebFluxTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
69626964

@@ -7016,7 +7018,8 @@ TIP: Sometimes writing Spring WebFlux tests is not enough; Spring Boot can help
70167018
==== Auto-configured Data Cassandra Tests
70177019
You can use `@DataCassandraTest` to test Cassandra applications.
70187020
By default, it configures a `CassandraTemplate`, scans for `@Table` classes, and configures Spring Data Cassandra repositories.
7019-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7021+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataCassandraTest` annotation is used.
7022+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
70207023
(For more about using Cassandra with Spring Boot, see "<<boot-features-cassandra>>", earlier in this chapter.)
70217024

70227025
TIP: A list of the auto-configuration settings that are enabled by `@DataCassandraTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
@@ -7045,7 +7048,8 @@ The following example shows a typical setup for using Cassandra tests in Spring
70457048
You can use the `@DataJpaTest` annotation to test JPA applications.
70467049
By default, it scans for `@Entity` classes and configures Spring Data JPA repositories.
70477050
If an embedded database is available on the classpath, it configures one as well.
7048-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7051+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataJpaTest` annotation is used.
7052+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
70497053

70507054
TIP: A list of the auto-configuration settings that are enabled by `@DataJpaTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
70517055

@@ -7119,7 +7123,8 @@ If, however, you prefer to run tests against a real database you can use the `@A
71197123
==== Auto-configured JDBC Tests
71207124
`@JdbcTest` is similar to `@DataJpaTest` but is for tests that only require a `DataSource` and do not use Spring Data JDBC.
71217125
By default, it configures an in-memory embedded database and a `JdbcTemplate`.
7122-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7126+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@JdbcTest` annotation is used.
7127+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
71237128

71247129
TIP: A list of the auto-configurations that are enabled by `@JdbcTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
71257130

@@ -7150,7 +7155,8 @@ If you prefer your test to run against a real database, you can use the `@AutoCo
71507155
==== Auto-configured Data JDBC Tests
71517156
`@DataJdbcTest` is similar to `@JdbcTest` but is for tests that use Spring Data JDBC repositories.
71527157
By default, it configures an in-memory embedded database, a `JdbcTemplate`, and Spring Data JDBC repositories.
7153-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7158+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataJdbcTest` annotation is used.
7159+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
71547160

71557161
TIP: A list of the auto-configurations that are enabled by `@DataJdbcTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
71567162

@@ -7169,12 +7175,12 @@ You can use `@JooqTest` in a similar fashion as `@JdbcTest` but for jOOQ-related
71697175
As jOOQ relies heavily on a Java-based schema that corresponds with the database schema, the existing `DataSource` is used.
71707176
If you want to replace it with an in-memory database, you can use `@AutoConfigureTestDatabase` to override those settings.
71717177
(For more about using jOOQ with Spring Boot, see "<<boot-features-jooq>>", earlier in this chapter.)
7172-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7178+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@JooqTest` annotation is used.
7179+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
71737180

71747181
TIP: A list of the auto-configurations that are enabled by `@JooqTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
71757182

71767183
`@JooqTest` configures a `DSLContext`.
7177-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
71787184
The following example shows the `@JooqTest` annotation in use:
71797185

71807186
[source,java,indent=0]
@@ -7200,7 +7206,8 @@ If that is not what you want, you can disable transaction management for a test
72007206
==== Auto-configured Data MongoDB Tests
72017207
You can use `@DataMongoTest` to test MongoDB applications.
72027208
By default, it configures an in-memory embedded MongoDB (if available), configures a `MongoTemplate`, scans for `@Document` classes, and configures Spring Data MongoDB repositories.
7203-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7209+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataMongoTest` annotation is used.
7210+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
72047211
(For more about using MongoDB with Spring Boot, see "<<boot-features-mongodb>>", earlier in this chapter.)
72057212

72067213
TIP: A list of the auto-configuration settings that are enabled by `@DataMongoTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
@@ -7243,7 +7250,8 @@ If, however, you prefer to run tests against a real MongoDB server, you should e
72437250
==== Auto-configured Data Neo4j Tests
72447251
You can use `@DataNeo4jTest` to test Neo4j applications.
72457252
By default, it scans for `@Node` classes, and configures Spring Data Neo4j repositories.
7246-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7253+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataNeo4jTest` annotation is used.
7254+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
72477255
(For more about using Neo4J with Spring Boot, see "<<boot-features-neo4j>>", earlier in this chapter.)
72487256

72497257
TIP: A list of the auto-configuration settings that are enabled by `@DataNeo4jTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
@@ -7288,7 +7296,8 @@ If that is not what you want, you can disable transaction management for a test
72887296
==== Auto-configured Data Redis Tests
72897297
You can use `@DataRedisTest` to test Redis applications.
72907298
By default, it scans for `@RedisHash` classes and configures Spring Data Redis repositories.
7291-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7299+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataRedisTest` annotation is used.
7300+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
72927301
(For more about using Redis with Spring Boot, see "<<boot-features-redis>>", earlier in this chapter.)
72937302

72947303
TIP: A list of the auto-configuration settings that are enabled by `@DataRedisTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
@@ -7316,7 +7325,8 @@ The following example shows the `@DataRedisTest` annotation in use:
73167325
==== Auto-configured Data LDAP Tests
73177326
You can use `@DataLdapTest` to test LDAP applications.
73187327
By default, it configures an in-memory embedded LDAP (if available), configures an `LdapTemplate`, scans for `@Entry` classes, and configures Spring Data LDAP repositories.
7319-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7328+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataLdapTest` annotation is used.
7329+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
73207330
(For more about using LDAP with Spring Boot, see "<<boot-features-ldap>>", earlier in this chapter.)
73217331

73227332
TIP: A list of the auto-configuration settings that are enabled by `@DataLdapTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
@@ -7359,7 +7369,8 @@ If, however, you prefer to run tests against a real LDAP server, you should excl
73597369
==== Auto-configured REST Clients
73607370
You can use the `@RestClientTest` annotation to test REST clients.
73617371
By default, it auto-configures Jackson, GSON, and Jsonb support, configures a `RestTemplateBuilder`, and adds support for `MockRestServiceServer`.
7362-
Regular `@Component` beans are not loaded into the `ApplicationContext`.
7372+
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@RestClientTest` annotation is used.
7373+
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
73637374

73647375
TIP: A list of the auto-configuration settings that are enabled by `@RestClientTest` can be <<appendix-test-auto-configuration.adoc#test-auto-configuration,found in the appendix>>.
73657376

0 commit comments

Comments
 (0)