Commit 3e82ede
committed
Require spring-boot-restclient dependency to use TestRestTemplate
Previously, spring-boot-restclient was a required dependency of
spring-boot-resttestclient. This had the unwanted side-effect of
increasing the risk of the test classpath enabling auto-configuration
for RestClient.Builder when it was main code that needed such a bean.
This could lead to integration tests passing but the application
itself failing to start when its run through its main method.
This commit makes spring-boot-restclient an optional dependency of
spring-boot-resttestclient. As a result, a dependency on
spring-boot-resttestclient is no longer sufficient to auto-configure
a RestClient.Builder bean, although it is still sufficient to
auto-configure a RestTestClient bean.
Those that wish to use TestRestTemplate rather than migrating to
RestTestClient will now have to add a dependency on
spring-boot-restclient. This makes it presence more obvious. It now
has to be declared directly rather than being somewhat hidden due to
being pulled in transitively. The hope is that this will reduce the
chances of the dependency being accidentially on the test classpath
when main code requires it to be on the runtime classpath.
Fixes gh-482531 parent 0e56cd0 commit 3e82ede
File tree
39 files changed
+45
-5
lines changed- documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing
- module/spring-boot-resttestclient
- smoke-test
- spring-boot-smoke-test-actuator-custom-security
- spring-boot-smoke-test-actuator-extension
- spring-boot-smoke-test-actuator-ui
- spring-boot-smoke-test-actuator
- spring-boot-smoke-test-devtools
- spring-boot-smoke-test-hateoas
- spring-boot-smoke-test-jersey
- spring-boot-smoke-test-jetty-jsp
- spring-boot-smoke-test-jetty-ssl
- spring-boot-smoke-test-jetty
- spring-boot-smoke-test-oauth2-authorization-server
- spring-boot-smoke-test-oauth2-client
- spring-boot-smoke-test-oauth2-resource-server
- spring-boot-smoke-test-prometheus
- spring-boot-smoke-test-quartz
- spring-boot-smoke-test-saml2-service-provider
- spring-boot-smoke-test-secure-jersey
- spring-boot-smoke-test-servlet
- spring-boot-smoke-test-session-jdbc
- spring-boot-smoke-test-tomcat-jsp
- spring-boot-smoke-test-tomcat-multi-connectors
- spring-boot-smoke-test-tomcat-ssl
- spring-boot-smoke-test-tomcat
- spring-boot-smoke-test-traditional
- spring-boot-smoke-test-web-freemarker
- spring-boot-smoke-test-web-groovy-templates
- spring-boot-smoke-test-web-jsp
- spring-boot-smoke-test-web-method-security
- spring-boot-smoke-test-web-mustache
- spring-boot-smoke-test-web-secure-custom
- spring-boot-smoke-test-web-secure-jdbc
- spring-boot-smoke-test-web-secure
- spring-boot-smoke-test-web-static
- spring-boot-smoke-test-web-thymeleaf
- spring-boot-smoke-test-webflux
- system-test/spring-boot-deployment-system-tests
39 files changed
+45
-5
lines changedLines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
204 | 208 | | |
205 | 209 | | |
206 | 210 | | |
| |||
documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/test-utilities.adoc
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
0 commit comments