From 3959c56bdd2a14b56101a6a9c871f7d492485964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Sat, 25 Jul 2026 07:51:06 +0200 Subject: [PATCH] Deprecate RestTemplate support With Spring Framework 7.1 deprecating RestTemplate for removal, this commit deprecates our supporting infrastructure as well, and steers users towards RestClient instead: * RestTemplateAutoConfiguration and RestTemplateObservationAutoConfiguration * RestTemplateBuilder, RestTemplateBuilderConfigurer, and RestTemplateBuilderClientHttpRequestInitializer * RestTemplateCustomizer, RestTemplateRequestCustomizer, and ObservationRestTemplateCustomizer * MockRestServiceServerAutoConfiguration, MockServerRestTemplateCustomizer, and RootUriRequestExpectationManager in the test support module The reference documentation no longer covers RestTemplate and now solely documents RestClient and WebClient. Code snippets and sample tests that only existed to illustrate RestTemplate usage have been removed accordingly. Closes gh-51118 --- .../modules/ROOT/pages/documentation.adoc | 2 +- .../antora/modules/ROOT/pages/redirect.adoc | 9 --- .../modules/how-to/pages/http-clients.adoc | 10 --- .../modules/how-to/pages/spring-mvc.adoc | 2 +- .../reference/pages/actuator/metrics.adoc | 7 +-- .../reference/pages/actuator/tracing.adoc | 4 +- .../reference/pages/io/rest-client.adoc | 63 +------------------ .../native-image/advanced-topics.adoc | 2 +- .../testing/spring-boot-applications.adoc | 8 +-- .../io/restclient/resttemplate/Details.java | 21 ------- .../io/restclient/resttemplate/MyService.java | 36 ----------- .../MyRestTemplateBuilderConfiguration.java | 36 ----------- .../MyRestTemplateCustomizer.java | 56 ----------------- .../resttemplate/ssl/MyService.java | 38 ----------- .../testresttemplate/MySpringBootTests.java | 1 + .../io/restclient/resttemplate/Details.kt | 20 ------ .../io/restclient/resttemplate/MyService.kt | 37 ----------- .../MyRestTemplateBuilderConfiguration.kt | 35 ----------- .../customization/MyRestTemplateCustomizer.kt | 51 --------------- .../restclient/resttemplate/ssl/MyService.kt | 38 ----------- .../testresttemplate/MySpringBootTests.kt | 2 + ...nmentUserDefinedTestRestTemplateTests.java | 2 + ...tTestUserDefinedTestRestTemplateTests.java | 2 + ...BootTestWebEnvironmentRandomPortTests.java | 1 + ...oundryHealthEndpointWebExtensionTests.java | 18 +++--- ...dFoundryInfoEndpointWebExtensionTests.java | 6 +- .../tests/DevToolsIntegrationTests.java | 1 + .../MockServerRestTemplateCustomizer.java | 4 ++ .../RootUriRequestExpectationManager.java | 3 + ...ockRestServiceServerAutoConfiguration.java | 2 + ...MockServerRestTemplateCustomizerTests.java | 3 + ...RootUriRequestExpectationManagerTests.java | 3 + .../AnotherExampleRestTemplateService.java | 3 + ...iceServerEnabledFalseIntegrationTests.java | 1 + ...thRestTemplateRootUriIntegrationTests.java | 3 + .../ExampleRestTemplateService.java | 3 + ...stServiceServerAutoConfigurationTests.java | 4 ++ ...ClientTestNoComponentIntegrationTests.java | 3 + ...AndRestClientTogetherIntegrationTests.java | 1 + ...lientTestRestTemplateIntegrationTests.java | 3 + ...TemplateTwoComponentsIntegrationTests.java | 3 + ...RestTemplateComponentIntegrationTests.java | 3 + ...entTestWithoutJacksonIntegrationTests.java | 6 +- .../boot/restclient/RestTemplateBuilder.java | 4 ++ ...teBuilderClientHttpRequestInitializer.java | 3 + .../restclient/RestTemplateCustomizer.java | 3 + .../RestTemplateRequestCustomizer.java | 2 + .../RestTemplateAutoConfiguration.java | 4 ++ .../RestTemplateBuilderConfigurer.java | 4 ++ ...tTemplateObservationAutoConfiguration.java | 4 ++ .../ObservationRestTemplateCustomizer.java | 4 ++ ...estClientWithRestTemplateBuilderTests.java | 3 + .../RestClientWithRestTemplateTests.java | 3 + ...lderClientHttpRequestInitializerTests.java | 3 + .../restclient/RestTemplateBuilderTests.java | 3 + .../RestTemplateAutoConfigurationTests.java | 3 + ...lateObservationAutoConfigurationTests.java | 3 + ...nAutoConfigurationWithoutMetricsTests.java | 3 + ...bservationRestTemplateCustomizerTests.java | 3 + .../boot/resttestclient/TestRestTemplate.java | 1 + ...TestRestTemplateTestAutoConfiguration.java | 1 + .../resttestclient/TestRestTemplateTests.java | 1 + .../CorsSampleActuatorApplicationTests.java | 1 + ...mpleActuatorExtensionApplicationTests.java | 1 + .../CorsSampleActuatorApplicationTests.java | 1 + .../tomcat/SampleTomcatApplicationTests.java | 1 + .../deployment/AbstractDeploymentTests.java | 1 + 67 files changed, 137 insertions(+), 479 deletions(-) delete mode 100644 documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/Details.java delete mode 100644 documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/MyService.java delete mode 100644 documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.java delete mode 100644 documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.java delete mode 100644 documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.java delete mode 100644 documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/Details.kt delete mode 100644 documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/MyService.kt delete mode 100644 documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.kt delete mode 100644 documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.kt delete mode 100644 documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.kt diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/documentation.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/documentation.adoc index 8406a8860c1..59ac3c8f569 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/documentation.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/documentation.adoc @@ -106,7 +106,7 @@ If your application needs IO capabilities, see one or more of the following sect * *Quartz:* xref:reference:io/quartz.adoc[Quartz Scheduling] * *Mail:* xref:reference:io/email.adoc[Sending Email] * *Validation:* xref:reference:io/validation.adoc[JSR-303 Validation] -* *REST Clients:* xref:reference:io/rest-client.adoc[Calling REST Services with RestTemplate and WebClient] +* *REST Clients:* xref:reference:io/rest-client.adoc[Calling REST Services with RestClient and WebClient] * *Webservices:* xref:reference:io/webservices.adoc[Auto-configuration for Spring Web Services] * *JTA:* xref:reference:io/jta.adoc[Distributed Transactions with JTA] diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc index 393ca0ded32..650798f890d 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc @@ -539,8 +539,6 @@ * xref:how-to:hotswapping.adoc#howto.hotswapping.reload-templates[#howto.hotswapping.reload-templates] * xref:how-to:hotswapping.adoc#howto.hotswapping[#howto-hotswapping] * xref:how-to:hotswapping.adoc#howto.hotswapping[#howto.hotswapping] -* xref:how-to:http-clients.adoc#howto.http-clients.rest-template-proxy-configuration[#howto-http-clients-proxy-configuration] -* xref:how-to:http-clients.adoc#howto.http-clients.rest-template-proxy-configuration[#howto.http-clients.rest-template-proxy-configuration] * xref:how-to:http-clients.adoc#howto.http-clients.webclient-reactor-netty-customization[#howto-webclient-reactor-netty-customization] * xref:how-to:http-clients.adoc#howto.http-clients.webclient-reactor-netty-customization[#howto.http-clients.webclient-reactor-netty-customization] * xref:how-to:http-clients.adoc#howto.http-clients[#howto-http-clients] @@ -1682,13 +1680,6 @@ * xref:reference:io/rest-client.adoc#io.rest-client.restclient.customization[#io.rest-client.restclient.customization] * xref:reference:io/rest-client.adoc#io.rest-client.restclient.ssl[#io.rest-client.restclient.ssl] * xref:reference:io/rest-client.adoc#io.rest-client.restclient[#io.rest-client.restclient] -* xref:reference:io/rest-client.adoc#io.rest-client.resttemplate.customization[#boot-features-resttemplate-customization] -* xref:reference:io/rest-client.adoc#io.rest-client.resttemplate.customization[#features.resttemplate.customization] -* xref:reference:io/rest-client.adoc#io.rest-client.resttemplate.customization[#io.rest-client.resttemplate.customization] -* xref:reference:io/rest-client.adoc#io.rest-client.resttemplate.ssl[#io.rest-client.resttemplate.ssl] -* xref:reference:io/rest-client.adoc#io.rest-client.resttemplate[#boot-features-resttemplate] -* xref:reference:io/rest-client.adoc#io.rest-client.resttemplate[#features.resttemplate] -* xref:reference:io/rest-client.adoc#io.rest-client.resttemplate[#io.rest-client.resttemplate] * xref:reference:io/rest-client.adoc#io.rest-client.webclient.customization[#boot-features-webclient-customization] * xref:reference:io/rest-client.adoc#io.rest-client.webclient.customization[#features.webclient.customization] * xref:reference:io/rest-client.adoc#io.rest-client.webclient.customization[#io.rest-client.webclient.customization] diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/http-clients.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/http-clients.adoc index 583b08569ab..0df0eee8ca5 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/http-clients.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/http-clients.adoc @@ -6,16 +6,6 @@ This section answers questions related to using them. -[[howto.http-clients.rest-template-proxy-configuration]] -== Configure RestTemplate to Use a Proxy - -As described in xref:reference:io/rest-client.adoc#io.rest-client.resttemplate.customization[RestTemplate Customization], you can use a javadoc:org.springframework.boot.restclient.RestTemplateCustomizer[] with javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] to build a customized javadoc:org.springframework.web.client.RestTemplate[]. -This is the recommended approach for creating a javadoc:org.springframework.web.client.RestTemplate[] configured to use a proxy. - -The exact details of the proxy configuration depend on the underlying client request factory that is being used. - - - [[howto.http-clients.webclient-reactor-netty-customization]] == Configure the TcpClient used by a Reactor Netty-based WebClient diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/spring-mvc.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/spring-mvc.adoc index 82a99e7cce9..f1b2811071e 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/spring-mvc.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/spring-mvc.adoc @@ -135,7 +135,7 @@ Spring uses javadoc:org.springframework.boot.http.converter.autoconfigure.HttpMe You can contribute additional converters by adding beans of the appropriate type in a Spring Boot context. If a bean you add is of a type that would have been included by default anyway (such as javadoc:org.springframework.http.converter.json.JacksonJsonHttpMessageConverter[] for JSON conversions), it replaces the default value. A convenience bean of type javadoc:org.springframework.boot.http.converter.autoconfigure.HttpMessageConverters[] is provided and is always available if you use the default MVC configuration. -It has some useful methods to access the default and user-enhanced message converters (For example, it can be useful if you want to manually inject them into a custom javadoc:org.springframework.web.client.RestTemplate[]). +It has some useful methods to access the default and user-enhanced message converters (For example, it can be useful if you want to manually inject them into a custom javadoc:org.springframework.web.client.RestClient[]). As in normal MVC usage, any javadoc:org.springframework.web.servlet.config.annotation.WebMvcConfigurer[] beans that you provide can also contribute converters by overriding the `configureMessageConverters` method. However, unlike with normal MVC, you can supply only additional converters that you need (because Spring Boot uses the same mechanism to contribute its defaults). diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/metrics.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/metrics.adoc index 9b20630a8c6..9dc34353b35 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/metrics.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/metrics.adoc @@ -840,21 +840,20 @@ This metric is tagged with the following information: [[actuator.metrics.supported.http-clients]] === HTTP Client Metrics -Spring Boot Actuator manages the instrumentation of javadoc:org.springframework.web.client.RestTemplate[], javadoc:org.springframework.web.reactive.function.client.WebClient[] and javadoc:org.springframework.web.client.RestClient[]. +Spring Boot Actuator manages the instrumentation of javadoc:org.springframework.web.reactive.function.client.WebClient[] and javadoc:org.springframework.web.client.RestClient[]. For that, you have to inject the auto-configured builder and use it to create instances: -* javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] for javadoc:org.springframework.web.client.RestTemplate[] * javadoc:org.springframework.web.reactive.function.client.WebClient$Builder[] for javadoc:org.springframework.web.reactive.function.client.WebClient[] * javadoc:org.springframework.web.client.RestClient$Builder[] for javadoc:org.springframework.web.client.RestClient[] -You can also manually apply the customizers responsible for this instrumentation, namely javadoc:org.springframework.boot.restclient.observation.ObservationRestTemplateCustomizer[], javadoc:org.springframework.boot.webclient.observation.ObservationWebClientCustomizer[] and javadoc:org.springframework.boot.restclient.observation.ObservationRestClientCustomizer[]. +You can also manually apply the customizers responsible for this instrumentation, namely javadoc:org.springframework.boot.webclient.observation.ObservationWebClientCustomizer[] and javadoc:org.springframework.boot.restclient.observation.ObservationRestClientCustomizer[]. By default, metrics are generated with the name, `http.client.requests`. You can customize the name by setting the configprop:management.observations.http.client.requests.name[] property. See the {url-spring-framework-docs}/integration/observability.html#observability.http-client[Spring Framework reference documentation for more information on produced observations]. -To customize the tags when using javadoc:org.springframework.web.client.RestTemplate[] or javadoc:org.springframework.web.client.RestClient[], provide a javadoc:org.springframework.context.annotation.Bean[format=annotation] that implements javadoc:org.springframework.http.client.observation.ClientRequestObservationConvention[] from the `org.springframework.http.client.observation` package. +To customize the tags when using javadoc:org.springframework.web.client.RestClient[], provide a javadoc:org.springframework.context.annotation.Bean[format=annotation] that implements javadoc:org.springframework.http.client.observation.ClientRequestObservationConvention[] from the `org.springframework.http.client.observation` package. To customize the tags when using javadoc:org.springframework.web.reactive.function.client.WebClient[], provide a javadoc:org.springframework.context.annotation.Bean[format=annotation] that implements javadoc:org.springframework.web.reactive.function.client.ClientRequestObservationConvention[] from the `org.springframework.web.reactive.function.client` package. diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/tracing.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/tracing.adoc index 1d270ff91cf..72c7cb0d6fa 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/tracing.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/tracing.adoc @@ -97,9 +97,9 @@ Please read xref:reference:actuator/observability.adoc#actuator.observability.co [[actuator.micrometer-tracing.propagating-traces]] == Propagating Traces -To automatically propagate traces over the network, use the auto-configured xref:io/rest-client.adoc#io.rest-client.resttemplate[`RestTemplateBuilder`], xref:io/rest-client.adoc#io.rest-client.restclient[`RestClient.Builder`] or xref:io/rest-client.adoc#io.rest-client.webclient[`WebClient.Builder`] to construct the client. +To automatically propagate traces over the network, use the auto-configured xref:io/rest-client.adoc#io.rest-client.restclient[`RestClient.Builder`] or xref:io/rest-client.adoc#io.rest-client.webclient[`WebClient.Builder`] to construct the client. -WARNING: If you create the javadoc:org.springframework.web.client.RestTemplate[], the javadoc:org.springframework.web.client.RestClient[] or the javadoc:org.springframework.web.reactive.function.client.WebClient[] without using the auto-configured builders, automatic trace propagation won't work! +WARNING: If you create the javadoc:org.springframework.web.client.RestClient[] or the javadoc:org.springframework.web.reactive.function.client.WebClient[] without using the auto-configured builders, automatic trace propagation won't work! diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/io/rest-client.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/io/rest-client.adoc index c5c5b20d222..0f9af6bea5d 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/io/rest-client.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/io/rest-client.adoc @@ -3,7 +3,7 @@ Spring Boot provides various convenient ways to call remote REST services. If you are developing a non-blocking reactive application and you're using Spring WebFlux, then you can use javadoc:org.springframework.web.reactive.function.client.WebClient[]. -If you prefer imperative APIs then you can use javadoc:org.springframework.web.client.RestClient[] or javadoc:org.springframework.web.client.RestTemplate[]. +If you prefer imperative APIs then you can use javadoc:org.springframework.web.client.RestClient[]. @@ -159,67 +159,10 @@ include-code::settings/MyService[] -[[io.rest-client.resttemplate]] -== RestTemplate - -Spring Framework's javadoc:org.springframework.web.client.RestTemplate[] class predates javadoc:org.springframework.web.client.RestClient[] and is the classic way that many applications use to call remote REST services. -You might choose to use javadoc:org.springframework.web.client.RestTemplate[] when you have existing code that you don't want to migrate to javadoc:org.springframework.web.client.RestClient[], or because you're already familiar with the javadoc:org.springframework.web.client.RestTemplate[] API. - -Since javadoc:org.springframework.web.client.RestTemplate[] instances often need to be customized before being used, Spring Boot does not provide any single auto-configured javadoc:org.springframework.web.client.RestTemplate[] bean. -It does, however, auto-configure a javadoc:org.springframework.boot.restclient.RestTemplateBuilder[], which can be used to create javadoc:org.springframework.web.client.RestTemplate[] instances when needed. -The auto-configured javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] ensures that sensible javadoc:org.springframework.boot.http.converter.autoconfigure.HttpMessageConverters[] and an appropriate javadoc:org.springframework.http.client.ClientHttpRequestFactory[] are applied to javadoc:org.springframework.web.client.RestTemplate[] instances. - -The following code shows a typical example: - -include-code::MyService[] - -javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] includes a number of useful methods that can be used to quickly configure a javadoc:org.springframework.web.client.RestTemplate[]. -For example, to add BASIC authentication support, you can use `builder.basicAuthentication("user", "password").build()`. - - - -[[io.rest-client.resttemplate.customization]] -=== RestTemplate Customization - -There are three main approaches to javadoc:org.springframework.web.client.RestTemplate[] customization, depending on how broadly you want the customizations to apply. - -To make the scope of any customizations as narrow as possible, inject the auto-configured javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] and then call its methods as required. -Each method call returns a new javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] instance, so the customizations only affect this use of the builder. - -To make an application-wide, additive customization, use a javadoc:org.springframework.boot.restclient.RestTemplateCustomizer[] bean. -All such beans are automatically registered with the auto-configured javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] and are applied to any templates that are built with it. - -The following example shows a customizer that configures the use of a proxy for all hosts except `192.168.0.5`: - -include-code::MyRestTemplateCustomizer[] - -Finally, you can define your own javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] bean. -Doing so will replace the auto-configured builder. -If you want any javadoc:org.springframework.boot.restclient.RestTemplateCustomizer[] beans to be applied to your custom builder, as the auto-configuration would have done, configure it using a javadoc:org.springframework.boot.restclient.autoconfigure.RestTemplateBuilderConfigurer[]. -The following example exposes a javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] that matches what Spring Boot's auto-configuration would have done, except that custom connect and read timeouts are also specified: - -include-code::MyRestTemplateBuilderConfiguration[] - -The most extreme (and rarely used) option is to create your own javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] bean without using a configurer. -In addition to replacing the auto-configured builder, this also prevents any javadoc:org.springframework.boot.restclient.RestTemplateCustomizer[] beans from being used. - -TIP: You can also change the xref:io/rest-client.adoc#io.rest-client.clienthttprequestfactory.configuration[global HTTP client configuration]. - - - -[[io.rest-client.resttemplate.ssl]] -=== RestTemplate SSL Support - -If you need custom SSL configuration on the javadoc:org.springframework.web.client.RestTemplate[], you can apply an xref:features/ssl.adoc#features.ssl.bundles[SSL bundle] to the javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] as shown in this example: - -include-code::MyService[] - - - [[io.rest-client.clienthttprequestfactory]] -== HTTP Client Detection for RestClient and RestTemplate +== HTTP Client Detection for RestClient -Spring Boot will auto-detect which HTTP client to use with javadoc:org.springframework.web.client.RestClient[] and javadoc:org.springframework.web.client.RestTemplate[] depending on the libraries available on the application classpath. +Spring Boot will auto-detect which HTTP client to use with javadoc:org.springframework.web.client.RestClient[] depending on the libraries available on the application classpath. In order of preference, the following clients are supported: . Apache HttpClient diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/advanced-topics.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/advanced-topics.adoc index 9360231e7eb..ff92a605292 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/advanced-topics.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/packaging/native-image/advanced-topics.adoc @@ -168,7 +168,7 @@ You can then use javadoc:org.springframework.context.annotation.ImportRuntimeHin If you have classes which need binding (mostly needed when serializing or deserializing JSON), you can use {url-spring-framework-docs}/core/aot.html#aot.hints.register-reflection-for-binding[`@RegisterReflectionForBinding`] on any bean. Most of the hints are automatically inferred, for example when accepting or returning data from a javadoc:org.springframework.web.bind.annotation.RestController[format=annotation] method. -But when you work with javadoc:org.springframework.web.reactive.function.client.WebClient[], javadoc:org.springframework.web.client.RestClient[] or javadoc:org.springframework.web.client.RestTemplate[] directly, you might need to use javadoc:org.springframework.aot.hint.annotation.RegisterReflectionForBinding[format=annotation]. +But when you work with javadoc:org.springframework.web.reactive.function.client.WebClient[] or javadoc:org.springframework.web.client.RestClient[] directly, you might need to use javadoc:org.springframework.aot.hint.annotation.RegisterReflectionForBinding[format=annotation]. diff --git a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc index f5307e6757f..1eac09c2cde 100644 --- a/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc +++ b/documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc @@ -732,7 +732,7 @@ include-code::server/MyDataLdapTests[] == Auto-configured REST Clients You can use the javadoc:org.springframework.boot.restclient.test.autoconfigure.RestClientTest[format=annotation] annotation from the `spring-boot-restclient-test` module to test REST clients. -By default, it auto-configures Jackson, GSON, and Jsonb support, configures a javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] and a javadoc:org.springframework.web.client.RestClient$Builder[], and adds support for javadoc:org.springframework.test.web.client.MockRestServiceServer[]. +By default, it auto-configures Jackson, GSON, and Jsonb support, configures a javadoc:org.springframework.web.client.RestClient$Builder[], and adds support for javadoc:org.springframework.test.web.client.MockRestServiceServer[]. Regular javadoc:org.springframework.stereotype.Component[format=annotation] and javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] beans are not scanned when the javadoc:org.springframework.boot.restclient.test.autoconfigure.RestClientTest[format=annotation] annotation is used. javadoc:org.springframework.boot.context.properties.EnableConfigurationProperties[format=annotation] can be used to include javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] beans. @@ -740,11 +740,7 @@ TIP: A list of the auto-configuration settings that are enabled by javadoc:org.s The specific beans that you want to test should be specified by using the `value` or `components` attribute of javadoc:org.springframework.boot.restclient.test.autoconfigure.RestClientTest[format=annotation]. -When using a javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] in the beans under test and `RestTemplateBuilder.baseUri(String baseUri)` has been called when building the javadoc:org.springframework.web.client.RestTemplate[], then the base URI should be omitted from the javadoc:org.springframework.test.web.client.MockRestServiceServer[] expectations as shown in the following example: - -include-code::MyRestTemplateServiceTests[] - -When using a javadoc:org.springframework.web.client.RestClient$Builder[] in the beans under test, or when using a javadoc:org.springframework.boot.restclient.RestTemplateBuilder[] without calling `baseUri(String baseUri)`, the full URI must be used in the javadoc:org.springframework.test.web.client.MockRestServiceServer[] expectations as shown in the following example: +When using a javadoc:org.springframework.web.client.RestClient$Builder[] in the beans under test, the full URI must be used in the javadoc:org.springframework.test.web.client.MockRestServiceServer[] expectations as shown in the following example: include-code::MyRestClientServiceTests[] diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/Details.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/Details.java deleted file mode 100644 index fb0ed4ae59a..00000000000 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/Details.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate; - -public class Details { - -} diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/MyService.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/MyService.java deleted file mode 100644 index a537d11bf0b..00000000000 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/MyService.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate; - -import org.springframework.boot.restclient.RestTemplateBuilder; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class MyService { - - private final RestTemplate restTemplate; - - public MyService(RestTemplateBuilder restTemplateBuilder) { - this.restTemplate = restTemplateBuilder.build(); - } - - public Details someRestCall(String name) { - return this.restTemplate.getForObject("/{name}/details", Details.class, name); - } - -} diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.java deleted file mode 100644 index f9a6d113bbe..00000000000 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate.customization; - -import java.time.Duration; - -import org.springframework.boot.restclient.RestTemplateBuilder; -import org.springframework.boot.restclient.autoconfigure.RestTemplateBuilderConfigurer; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration(proxyBeanMethods = false) -public class MyRestTemplateBuilderConfiguration { - - @Bean - public RestTemplateBuilder restTemplateBuilder(RestTemplateBuilderConfigurer configurer) { - return configurer.configure(new RestTemplateBuilder()) - .connectTimeout(Duration.ofSeconds(5)) - .readTimeout(Duration.ofSeconds(2)); - } - -} diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.java deleted file mode 100644 index 98e052a1863..00000000000 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate.customization; - -import org.apache.hc.client5.http.classic.HttpClient; -import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; -import org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner; -import org.apache.hc.client5.http.routing.HttpRoutePlanner; -import org.apache.hc.core5.http.HttpException; -import org.apache.hc.core5.http.HttpHost; -import org.apache.hc.core5.http.protocol.HttpContext; - -import org.springframework.boot.restclient.RestTemplateCustomizer; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; - -public class MyRestTemplateCustomizer implements RestTemplateCustomizer { - - @Override - public void customize(RestTemplate restTemplate) { - HttpRoutePlanner routePlanner = new CustomRoutePlanner(new HttpHost("proxy.example.com")); - HttpClient httpClient = HttpClientBuilder.create().setRoutePlanner(routePlanner).build(); - restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient)); - } - - static class CustomRoutePlanner extends DefaultProxyRoutePlanner { - - CustomRoutePlanner(HttpHost proxy) { - super(proxy); - } - - @Override - protected HttpHost determineProxy(HttpHost target, HttpContext context) throws HttpException { - if (target.getHostName().equals("192.168.0.5")) { - return null; - } - return super.determineProxy(target, context); - } - - } - -} diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.java deleted file mode 100644 index d488da14a66..00000000000 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate.ssl; - -import org.springframework.boot.docs.io.restclient.resttemplate.Details; -import org.springframework.boot.restclient.RestTemplateBuilder; -import org.springframework.boot.ssl.SslBundles; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class MyService { - - private final RestTemplate restTemplate; - - public MyService(RestTemplateBuilder restTemplateBuilder, SslBundles sslBundles) { - this.restTemplate = restTemplateBuilder.sslBundle(sslBundles.getBundle("mybundle")).build(); - } - - public Details someRestCall(String name) { - return this.restTemplate.getForObject("/{name}/details", Details.class, name); - } - -} diff --git a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java index 4abeb71040d..ccedfe30b18 100644 --- a/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java +++ b/documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.java @@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @AutoConfigureTestRestTemplate +@SuppressWarnings("removal") class MySpringBootTests { @Autowired diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/Details.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/Details.kt deleted file mode 100644 index 29278b49d75..00000000000 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/Details.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate - -class Details - diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/MyService.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/MyService.kt deleted file mode 100644 index 3778c5ed5c5..00000000000 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/MyService.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate - -import org.springframework.boot.restclient.RestTemplateBuilder -import org.springframework.stereotype.Service -import org.springframework.web.client.RestTemplate - -@Service -class MyService(restTemplateBuilder: RestTemplateBuilder) { - - private val restTemplate: RestTemplate - - init { - restTemplate = restTemplateBuilder.build() - } - - fun someRestCall(name: String): Details { - return restTemplate.getForObject("/{name}/details", Details::class.java, name)!! - } - -} - diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.kt deleted file mode 100644 index 57bfd52ebd6..00000000000 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateBuilderConfiguration.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate.customization - -import org.springframework.boot.restclient.autoconfigure.RestTemplateBuilderConfigurer -import org.springframework.boot.restclient.RestTemplateBuilder -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import java.time.Duration - -@Configuration(proxyBeanMethods = false) -class MyRestTemplateBuilderConfiguration { - - @Bean - fun restTemplateBuilder(configurer: RestTemplateBuilderConfigurer): RestTemplateBuilder { - return configurer.configure(RestTemplateBuilder()).connectTimeout(Duration.ofSeconds(5)) - .readTimeout(Duration.ofSeconds(2)) - } - -} - diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.kt deleted file mode 100644 index 4bdc28fae72..00000000000 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.docs.io.restclient.resttemplate.customization - -import org.apache.hc.client5.http.classic.HttpClient -import org.apache.hc.client5.http.impl.classic.HttpClientBuilder -import org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner -import org.apache.hc.client5.http.routing.HttpRoutePlanner -import org.apache.hc.core5.http.HttpException -import org.apache.hc.core5.http.HttpHost -import org.apache.hc.core5.http.protocol.HttpContext -import org.springframework.boot.restclient.RestTemplateCustomizer -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory -import org.springframework.web.client.RestTemplate - -class MyRestTemplateCustomizer : RestTemplateCustomizer { - - override fun customize(restTemplate: RestTemplate) { - val routePlanner: HttpRoutePlanner = CustomRoutePlanner(HttpHost("proxy.example.com")) - val httpClient: HttpClient = HttpClientBuilder.create().setRoutePlanner(routePlanner).build() - restTemplate.requestFactory = HttpComponentsClientHttpRequestFactory(httpClient) - } - - internal class CustomRoutePlanner(proxy: HttpHost?) : DefaultProxyRoutePlanner(proxy) { - - @Throws(HttpException::class) - public override fun determineProxy(target: HttpHost, context: HttpContext): HttpHost? { - if (target.hostName == "192.168.0.5") { - return null - } - return super.determineProxy(target, context) - } - - } - -} - diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.kt deleted file mode 100644 index cbf24622815..00000000000 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/io/restclient/resttemplate/ssl/MyService.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2012-present 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.boot.docs.io.restclient.resttemplate.ssl - -import org.springframework.boot.docs.io.restclient.resttemplate.Details -import org.springframework.boot.ssl.SslBundles -import org.springframework.boot.restclient.RestTemplateBuilder -import org.springframework.stereotype.Service -import org.springframework.web.client.RestTemplate - -@Service -class MyService(restTemplateBuilder: RestTemplateBuilder, sslBundles: SslBundles) { - - private val restTemplate: RestTemplate - - init { - restTemplate = restTemplateBuilder.sslBundle(sslBundles.getBundle("mybundle")).build() - } - - fun someRestCall(name: String): Details { - return restTemplate.getForObject("/{name}/details", Details::class.java, name)!! - } - -} - diff --git a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt index ed212753bee..a873041114b 100644 --- a/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt +++ b/documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/utilities/testresttemplate/MySpringBootTests.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +@file:Suppress("DEPRECATION") + package org.springframework.boot.docs.testing.utilities.testresttemplate import org.assertj.core.api.Assertions.assertThat diff --git a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java index 4372bb33ee3..30b0ee966f1 100644 --- a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests.java @@ -34,10 +34,12 @@ import static org.assertj.core.api.Assertions.assertThat; * with a user-defined {@link RestTemplate} that is named {@code testRestTemplate}. * * @author Madhura Bhave + * @deprecated since 4.2.0 for removal in 4.4.0 */ @DirtiesContext @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.main.web-application-type=reactive", "value=123" }) +@Deprecated(since = "4.2.0", forRemoval = true) class SpringBootTestReactiveWebEnvironmentUserDefinedTestRestTemplateTests extends AbstractSpringBootTestEmbeddedReactiveWebEnvironmentTests { diff --git a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java index 82c46ac7927..33708468941 100644 --- a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestUserDefinedTestRestTemplateTests.java @@ -35,9 +35,11 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Phillip Webb * @author Andy Wilkinson + * @deprecated since 4.2.0 for removal in 4.4.0 */ @DirtiesContext @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "value=123" }) +@Deprecated(since = "4.2.0", forRemoval = true) class SpringBootTestUserDefinedTestRestTemplateTests extends AbstractSpringBootTestWebServerWebEnvironmentTests { @Test diff --git a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java index a6cf4b62bc9..ceabe364574 100644 --- a/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java +++ b/integration-test/spring-boot-test-integration-tests/src/test/java/org/springframework/boot/web/server/test/SpringBootTestWebEnvironmentRandomPortTests.java @@ -39,6 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @DirtiesContext @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "value=123" }) +@SuppressWarnings("removal") class SpringBootTestWebEnvironmentRandomPortTests extends AbstractSpringBootTestWebServerWebEnvironmentTests { @Test diff --git a/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryHealthEndpointWebExtensionTests.java b/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryHealthEndpointWebExtensionTests.java index 4f5c1ce2368..f56569cc072 100644 --- a/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryHealthEndpointWebExtensionTests.java +++ b/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryHealthEndpointWebExtensionTests.java @@ -36,7 +36,6 @@ import org.springframework.boot.health.contributor.Health; import org.springframework.boot.health.contributor.HealthIndicator; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration; -import org.springframework.boot.restclient.autoconfigure.RestTemplateAutoConfiguration; import org.springframework.boot.security.autoconfigure.SecurityAutoConfiguration; import org.springframework.boot.security.autoconfigure.web.servlet.ServletWebSecurityAutoConfiguration; import org.springframework.boot.servlet.autoconfigure.actuate.web.ServletManagementContextAutoConfiguration; @@ -55,15 +54,14 @@ class CloudFoundryHealthEndpointWebExtensionTests { private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() .withPropertyValues("VCAP_APPLICATION={}") - .withConfiguration( - AutoConfigurations.of(SecurityAutoConfiguration.class, ServletWebSecurityAutoConfiguration.class, - WebMvcAutoConfiguration.class, JacksonAutoConfiguration.class, - DispatcherServletAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, RestTemplateAutoConfiguration.class, - ManagementContextAutoConfiguration.class, ServletManagementContextAutoConfiguration.class, - EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class, - HealthContributorAutoConfiguration.class, HealthContributorRegistryAutoConfiguration.class, - HealthEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class)) + .withConfiguration(AutoConfigurations.of(SecurityAutoConfiguration.class, + ServletWebSecurityAutoConfiguration.class, WebMvcAutoConfiguration.class, + JacksonAutoConfiguration.class, DispatcherServletAutoConfiguration.class, + HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, + ManagementContextAutoConfiguration.class, ServletManagementContextAutoConfiguration.class, + EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class, + HealthContributorAutoConfiguration.class, HealthContributorRegistryAutoConfiguration.class, + HealthEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class)) .withUserConfiguration(TestHealthIndicator.class); @Test diff --git a/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryInfoEndpointWebExtensionTests.java b/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryInfoEndpointWebExtensionTests.java index 48c287a8cd7..3d15e89ee0e 100644 --- a/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryInfoEndpointWebExtensionTests.java +++ b/module/spring-boot-cloudfoundry/src/test/java/org/springframework/boot/cloudfoundry/autoconfigure/actuate/endpoint/servlet/CloudFoundryInfoEndpointWebExtensionTests.java @@ -31,7 +31,6 @@ import org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration; import org.springframework.boot.health.autoconfigure.actuate.endpoint.HealthEndpointAutoConfiguration; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration; -import org.springframework.boot.restclient.autoconfigure.RestTemplateAutoConfiguration; import org.springframework.boot.security.autoconfigure.SecurityAutoConfiguration; import org.springframework.boot.security.autoconfigure.web.servlet.ServletWebSecurityAutoConfiguration; import org.springframework.boot.servlet.autoconfigure.actuate.web.ServletManagementContextAutoConfiguration; @@ -55,9 +54,8 @@ class CloudFoundryInfoEndpointWebExtensionTests { ServletWebSecurityAutoConfiguration.class, WebMvcAutoConfiguration.class, JacksonAutoConfiguration.class, DispatcherServletAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, - RestTemplateAutoConfiguration.class, ManagementContextAutoConfiguration.class, - ServletManagementContextAutoConfiguration.class, EndpointAutoConfiguration.class, - WebEndpointAutoConfiguration.class, ProjectInfoAutoConfiguration.class, + ManagementContextAutoConfiguration.class, ServletManagementContextAutoConfiguration.class, + EndpointAutoConfiguration.class, WebEndpointAutoConfiguration.class, ProjectInfoAutoConfiguration.class, InfoContributorAutoConfiguration.class, InfoEndpointAutoConfiguration.class, HealthEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class)); diff --git a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index f6752a3780c..5d897df5fbb 100644 --- a/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/module/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -37,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Andy Wilkinson */ +@SuppressWarnings("removal") class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests { private final TestRestTemplate template = new TestRestTemplate(new RestTemplateBuilder() diff --git a/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizer.java b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizer.java index 29c282e35d6..f4383c04106 100644 --- a/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizer.java +++ b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizer.java @@ -61,7 +61,11 @@ import org.springframework.web.client.RestTemplate; * @since 4.0.0 * @see #getServer() * @see #getServer(RestTemplate) + * @deprecated since 4.2.0 for removal in 4.4.0 in favor of + * {@link MockServerRestClientCustomizer} */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public class MockServerRestTemplateCustomizer implements RestTemplateCustomizer { private final Map expectationManagers = new ConcurrentHashMap<>(); diff --git a/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManager.java b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManager.java index df22482633d..8e440a26f3b 100644 --- a/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManager.java +++ b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManager.java @@ -53,7 +53,10 @@ import org.springframework.web.util.UriTemplateHandler; * @see DefaultUriBuilderFactory * @see #bindTo(RestTemplate) * @see #forRestTemplate(RestTemplate, RequestExpectationManager) + * @deprecated since 4.2.0 for removal in 4.4.0 with no replacement */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public class RootUriRequestExpectationManager implements RequestExpectationManager { private final String rootUri; diff --git a/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfiguration.java b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfiguration.java index b40ad6546bb..7a1da8543fb 100644 --- a/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfiguration.java +++ b/module/spring-boot-restclient-test/src/main/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfiguration.java @@ -51,10 +51,12 @@ import org.springframework.web.client.RestTemplate; @AutoConfiguration @ConditionalOnClass(MockServerRestTemplateCustomizer.class) @ConditionalOnBooleanProperty("spring.test.restclient.mockrestserviceserver.enabled") +@SuppressWarnings("removal") public final class MockRestServiceServerAutoConfiguration { @Bean @ConditionalOnMissingBean + @Deprecated(since = "4.2.0", forRemoval = true) MockServerRestTemplateCustomizer mockServerRestTemplateCustomizer() { return new MockServerRestTemplateCustomizer(); } diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizerTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizerTests.java index fe380c19fd2..80c9e1d8cc1 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizerTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/MockServerRestTemplateCustomizerTests.java @@ -40,7 +40,10 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * * @author Phillip Webb * @author Moritz Halbritter + * @deprecated since 4.2.0 for removal in 4.4.0 */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class MockServerRestTemplateCustomizerTests { private MockServerRestTemplateCustomizer customizer; diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManagerTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManagerTests.java index 7e912d342c1..be16e13fe8d 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManagerTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/RootUriRequestExpectationManagerTests.java @@ -48,8 +48,11 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * Tests for {@link RootUriRequestExpectationManager}. * * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ @ExtendWith(MockitoExtension.class) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RootUriRequestExpectationManagerTests { private final String uri = "https://example.com"; diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AnotherExampleRestTemplateService.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AnotherExampleRestTemplateService.java index 7402effc3fd..5a3614cd578 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AnotherExampleRestTemplateService.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AnotherExampleRestTemplateService.java @@ -26,8 +26,11 @@ import org.springframework.web.client.RestTemplate; * A second example web client used with {@link RestClientTest @RestClientTest} tests. * * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ @Service +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public class AnotherExampleRestTemplateService { private final RestTemplate restTemplate; diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java index 27c5045203c..bc2a06e6f51 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests.java @@ -41,6 +41,7 @@ class AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests { private ApplicationContext applicationContext; @Test + @SuppressWarnings("removal") void mockServerRestTemplateCustomizerShouldNotBeRegistered() { assertThatExceptionOfType(NoSuchBeanDefinitionException.class) .isThrownBy(() -> this.applicationContext.getBean(MockServerRestTemplateCustomizer.class)); diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerWithRestTemplateRootUriIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerWithRestTemplateRootUriIntegrationTests.java index ec9de9d2fea..90dda87efdc 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerWithRestTemplateRootUriIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/AutoConfigureMockRestServiceServerWithRestTemplateRootUriIntegrationTests.java @@ -40,9 +40,12 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * {@link RestTemplate} configured with a root URI. * * @author Andy Wilkinson + * @deprecated since 4.2.0 for removal in 4.4.0 */ @SpringBootTest @AutoConfigureMockRestServiceServer +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class AutoConfigureMockRestServiceServerWithRestTemplateRootUriIntegrationTests { @Autowired diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/ExampleRestTemplateService.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/ExampleRestTemplateService.java index 5acc9d7b83d..75b505f92bf 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/ExampleRestTemplateService.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/ExampleRestTemplateService.java @@ -27,8 +27,11 @@ import org.springframework.web.client.RestTemplate; * {@link RestClientTest @RestClientTest} tests. * * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ @Service +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public class ExampleRestTemplateService { private final RestTemplate restTemplate; diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfigurationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfigurationTests.java index 87f4b52356f..6e77660d8ea 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfigurationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/MockRestServiceServerAutoConfigurationTests.java @@ -46,6 +46,8 @@ class MockRestServiceServerAutoConfigurationTests { } @Test + @Deprecated(since = "4.2.0", forRemoval = true) + @SuppressWarnings("removal") void registersMockServerRestTemplateCustomizer() { this.contextRunner.run((context) -> assertThat(context).hasSingleBean(MockServerRestTemplateCustomizer.class)); } @@ -63,6 +65,8 @@ class MockRestServiceServerAutoConfigurationTests { } @Test + @Deprecated(since = "4.2.0", forRemoval = true) + @SuppressWarnings("removal") void backsOffWhenUserProvidesMockServerRestTemplateCustomizer() { this.contextRunner.withBean("userMockServerRestTemplateCustomizer", MockServerRestTemplateCustomizer.class) .run((context) -> assertThat(context).hasSingleBean(MockServerRestTemplateCustomizer.class) diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestNoComponentIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestNoComponentIntegrationTests.java index 724c08b85d7..dbe9b32f2fe 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestNoComponentIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestNoComponentIntegrationTests.java @@ -34,8 +34,11 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * Tests for {@link RestClientTest @RestClientTest} with no specific client. * * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ @RestClientTest +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestClientTestNoComponentIntegrationTests { @Autowired diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateAndRestClientTogetherIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateAndRestClientTogetherIntegrationTests.java index a54a73b1bfe..e5444c0dd42 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateAndRestClientTogetherIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateAndRestClientTogetherIntegrationTests.java @@ -36,6 +36,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * @author Scott Frederick */ @RestClientTest({ ExampleRestTemplateService.class, ExampleRestClientService.class }) +@SuppressWarnings("removal") class RestClientTestRestTemplateAndRestClientTogetherIntegrationTests { @Autowired diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateIntegrationTests.java index 1a178c2ab32..ed9535758a2 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateIntegrationTests.java @@ -31,8 +31,11 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * Tests for {@link RestClientTest @RestClientTest} gets reset after test methods. * * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ @RestClientTest(ExampleRestTemplateService.class) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestClientTestRestTemplateIntegrationTests { @Autowired diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateTwoComponentsIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateTwoComponentsIntegrationTests.java index 90543c70054..9f6fcb1d1ce 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateTwoComponentsIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestRestTemplateTwoComponentsIntegrationTests.java @@ -32,8 +32,11 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * Tests for {@link RestClientTest @RestClientTest} with two {@code RestTemplate} clients. * * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ @RestClientTest({ ExampleRestTemplateService.class, AnotherExampleRestTemplateService.class }) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestClientTestRestTemplateTwoComponentsIntegrationTests { @Autowired diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithRestTemplateComponentIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithRestTemplateComponentIntegrationTests.java index 7d052a0ffe4..471fafb3399 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithRestTemplateComponentIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithRestTemplateComponentIntegrationTests.java @@ -31,8 +31,11 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * {@code RestTemplate}. * * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ @RestClientTest(ExampleRestTemplateService.class) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestClientTestWithRestTemplateComponentIntegrationTests { @Autowired diff --git a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithoutJacksonIntegrationTests.java b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithoutJacksonIntegrationTests.java index b5190fe6caa..47898f32ff5 100644 --- a/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithoutJacksonIntegrationTests.java +++ b/module/spring-boot-restclient-test/src/test/java/org/springframework/boot/restclient/test/autoconfigure/RestClientTestWithoutJacksonIntegrationTests.java @@ -34,21 +34,21 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * @author Andy Wilkinson */ @ClassPathExclusions("jackson-*.jar") -@RestClientTest(ExampleRestTemplateService.class) +@RestClientTest(ExampleRestClientService.class) class RestClientTestWithoutJacksonIntegrationTests { @Autowired private MockRestServiceServer server; @Autowired - private ExampleRestTemplateService client; + private ExampleRestClientService client; @Test void restClientTestCanBeUsedWhenJacksonIsNotOnTheClassPath() { ClassLoader classLoader = getClass().getClassLoader(); assertThat(ClassUtils.isPresent("com.fasterxml.jackson.databind.Module", classLoader)).isFalse(); assertThat(ClassUtils.isPresent("tools.jackson.databind.JacksonModule", classLoader)).isFalse(); - this.server.expect(requestTo("/test")).andRespond(withSuccess("hello", MediaType.TEXT_HTML)); + this.server.expect(requestTo("https://example.com/test")).andRespond(withSuccess("hello", MediaType.TEXT_HTML)); assertThat(this.client.test()).isEqualTo("hello"); } diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilder.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilder.java index 27abdf5450a..7f14fa85039 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilder.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilder.java @@ -45,6 +45,7 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.web.client.ResponseErrorHandler; +import org.springframework.web.client.RestClient; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.DefaultUriBuilderFactory; import org.springframework.web.util.UriTemplateHandler; @@ -71,7 +72,10 @@ import org.springframework.web.util.UriTemplateHandler; * @author Scott Frederick * @author Yanming Zhou * @since 4.0.0 + * @deprecated since 4.2.0 for removal in 4.4.0 in favor of {@link RestClient.Builder} */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public class RestTemplateBuilder { private final HttpClientSettings clientSettings; diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializer.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializer.java index 1aad218d55e..914ccc00cc3 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializer.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializer.java @@ -33,7 +33,10 @@ import org.springframework.http.client.ClientHttpRequestInitializer; * * @author Dmytro Nosan * @author Ilya Lukyanovich + * @deprecated since 4.2.0 for removal in 4.4.0 with no replacement */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestTemplateBuilderClientHttpRequestInitializer implements ClientHttpRequestInitializer { private final @Nullable BasicAuthentication basicAuthentication; diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateCustomizer.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateCustomizer.java index e0d0c81f056..f437b9cff3e 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateCustomizer.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateCustomizer.java @@ -24,8 +24,11 @@ import org.springframework.web.client.RestTemplate; * @author Phillip Webb * @since 4.0.0 * @see RestTemplateBuilder + * @deprecated since 4.2.0 for removal in 4.4.0 in favor of {@link RestClientCustomizer} */ @FunctionalInterface +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public interface RestTemplateCustomizer { /** diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateRequestCustomizer.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateRequestCustomizer.java index 03ecdf68438..32e2388c870 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateRequestCustomizer.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/RestTemplateRequestCustomizer.java @@ -30,8 +30,10 @@ import org.springframework.web.client.RestTemplate; * @since 4.0.0 * @see RestTemplateBuilder * @see ClientHttpRequestInitializer + * @deprecated since 4.2.0 for removal in 4.4.0 with no replacement */ @FunctionalInterface +@Deprecated(since = "4.2.0", forRemoval = true) public interface RestTemplateRequestCustomizer { /** diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfiguration.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfiguration.java index 9161d378ab5..d6910f6fe10 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfiguration.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfiguration.java @@ -41,10 +41,14 @@ import org.springframework.web.client.RestTemplate; * @author Stephane Nicoll * @author Phillip Webb * @since 4.0.0 + * @deprecated since 4.2.0 for removal in 4.4.0 in favor of + * {@link RestClientAutoConfiguration} */ @AutoConfiguration(after = HttpClientAutoConfiguration.class) @ConditionalOnClass({ RestTemplate.class, HttpMessageConverters.class }) @Conditional(NotReactiveWebApplicationCondition.class) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public final class RestTemplateAutoConfiguration { @Bean diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateBuilderConfigurer.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateBuilderConfigurer.java index dc54da61382..6c670fff991 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateBuilderConfigurer.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateBuilderConfigurer.java @@ -41,7 +41,11 @@ import org.springframework.util.ObjectUtils; * * @author Stephane Nicoll * @since 4.0.0 + * @deprecated since 4.2.0 for removal in 4.4.0 in favor of + * {@link RestClientBuilderConfigurer} */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public final class RestTemplateBuilderConfigurer { private @Nullable ClientHttpRequestFactoryBuilder requestFactoryBuilder; diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfiguration.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfiguration.java index fa2bff1946c..00e0c547161 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfiguration.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfiguration.java @@ -36,12 +36,16 @@ import org.springframework.web.client.RestTemplate; * * @author Brian Clozel * @since 4.0.0 + * @deprecated since 4.2.0 for removal in 4.4.0 in favor of + * {@link RestClientObservationAutoConfiguration} */ @AutoConfiguration @ConditionalOnClass({ RestTemplate.class, ObservationRestTemplateCustomizer.class, ObservationRegistry.class, ObservationProperties.class }) @ConditionalOnBean({ ObservationRegistry.class, RestTemplateBuilder.class }) @EnableConfigurationProperties(ObservationProperties.class) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public final class RestTemplateObservationAutoConfiguration { @Bean diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizer.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizer.java index a7338539da6..96b68a6078b 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizer.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizer.java @@ -28,7 +28,11 @@ import org.springframework.web.client.RestTemplate; * * @author Brian Clozel * @since 4.0.0 + * @deprecated since 4.2.0 for removal in 4.4.0 in favor of + * {@link ObservationRestClientCustomizer} */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") public class ObservationRestTemplateCustomizer implements RestTemplateCustomizer { private final ObservationRegistry observationRegistry; diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateBuilderTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateBuilderTests.java index 3a6dcb313d6..8544a3f2816 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateBuilderTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateBuilderTests.java @@ -31,7 +31,10 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * Tests for building a {@link RestClient} from a {@link RestTemplateBuilder}. * * @author Scott Frederick + * @deprecated since 4.2.0 for removal in 4.4.0 */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestClientWithRestTemplateBuilderTests { @Test diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateTests.java index 34a022c6a74..c5f7d2ee799 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestClientWithRestTemplateTests.java @@ -32,7 +32,10 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * Tests for building a {@link RestClient} from a {@link RestTemplate}. * * @author Scott Frederick + * @deprecated since 4.2.0 for removal in 4.4.0 */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestClientWithRestTemplateTests { @Test diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializerTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializerTests.java index 8a829be0f2a..8930b979da8 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializerTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderClientHttpRequestInitializerTests.java @@ -41,7 +41,10 @@ import static org.mockito.Mockito.mock; * @author Dmytro Nosan * @author Ilya Lukyanovich * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestTemplateBuilderClientHttpRequestInitializerTests { private final MockClientHttpRequest request = new MockClientHttpRequest(); diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderTests.java index e23285d1a8a..e453df73f47 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/RestTemplateBuilderTests.java @@ -80,8 +80,11 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * @author Ilya Lukyanovich * @author Brian Clozel * @author Yanming Zhou + * @deprecated since 4.2.0 for removal in 4.4.0 */ @ExtendWith(MockitoExtension.class) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestTemplateBuilderTests { private final RestTemplateBuilder builder = new RestTemplateBuilder(); diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfigurationTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfigurationTests.java index c35411ab694..d200b52b6da 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfigurationTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateAutoConfigurationTests.java @@ -59,7 +59,10 @@ import static org.mockito.Mockito.mock; * * @author Stephane Nicoll * @author Phillip Webb + * @deprecated since 4.2.0 for removal in 4.4.0 */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestTemplateAutoConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationTests.java index 4997d616399..717b2d307d6 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationTests.java @@ -49,8 +49,11 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * Tests for {@link RestTemplateObservationAutoConfiguration}. * * @author Brian Clozel + * @deprecated since 4.2.0 for removal in 4.4.0 */ @ExtendWith(OutputCaptureExtension.class) +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestTemplateObservationAutoConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationWithoutMetricsTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationWithoutMetricsTests.java index cf651483f04..f04100cc464 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationWithoutMetricsTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/autoconfigure/RestTemplateObservationAutoConfigurationWithoutMetricsTests.java @@ -41,9 +41,12 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * * @author Brian Clozel * @author Andy Wilkinson + * @deprecated since 4.2.0 for removal in 4.4.0 */ @ExtendWith(OutputCaptureExtension.class) @ClassPathExclusions("micrometer-core-*.jar") +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class RestTemplateObservationAutoConfigurationWithoutMetricsTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() diff --git a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizerTests.java b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizerTests.java index 6cfe5bc834c..2bc8f39871e 100644 --- a/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizerTests.java +++ b/module/spring-boot-restclient/src/test/java/org/springframework/boot/restclient/observation/ObservationRestTemplateCustomizerTests.java @@ -29,7 +29,10 @@ import static org.assertj.core.api.Assertions.assertThat; * Tests for {@link ObservationRestTemplateCustomizer}. * * @author Brian Clozel + * @deprecated since 4.2.0 for removal in 4.4.0 */ +@Deprecated(since = "4.2.0", forRemoval = true) +@SuppressWarnings("removal") class ObservationRestTemplateCustomizerTests { private static final String TEST_METRIC_NAME = "http.test.metric.name"; diff --git a/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/TestRestTemplate.java b/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/TestRestTemplate.java index 52ebd28f409..c2cde6ede09 100644 --- a/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/TestRestTemplate.java +++ b/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/TestRestTemplate.java @@ -91,6 +91,7 @@ import org.springframework.web.util.UriTemplateHandler; * @author Yanming Zhou * @since 4.0.0 */ +@SuppressWarnings("removal") public class TestRestTemplate { private final RestTemplateBuilder builder; diff --git a/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfiguration.java b/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfiguration.java index 453b45314f0..706a3f35ba7 100644 --- a/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfiguration.java +++ b/module/spring-boot-resttestclient/src/main/java/org/springframework/boot/resttestclient/autoconfigure/TestRestTemplateTestAutoConfiguration.java @@ -34,6 +34,7 @@ import org.springframework.context.annotation.Bean; * @see AutoConfigureTestRestTemplate */ @AutoConfiguration +@SuppressWarnings("removal") final class TestRestTemplateTestAutoConfiguration { @Bean(name = "org.springframework.boot.resttestclient.TestRestTemplate") diff --git a/module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/TestRestTemplateTests.java b/module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/TestRestTemplateTests.java index b621b1e018f..052055cb2eb 100644 --- a/module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/TestRestTemplateTests.java +++ b/module/spring-boot-resttestclient/src/test/java/org/springframework/boot/resttestclient/TestRestTemplateTests.java @@ -81,6 +81,7 @@ import static org.mockito.Mockito.mock; * @author Kristine Jetzke * @author Yanming Zhou */ +@SuppressWarnings("removal") class TestRestTemplateTests { @Test diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java index c32cb39606e..456f7e2c592 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/CorsSampleActuatorApplicationTests.java @@ -44,6 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("cors") @AutoConfigureTestRestTemplate +@SuppressWarnings("removal") class CorsSampleActuatorApplicationTests { private TestRestTemplate testRestTemplate; diff --git a/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java index 9f640e6ea04..d6db28f024c 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-extension/src/test/java/smoketest/actuator/extension/SampleActuatorExtensionApplicationTests.java @@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.web.error.include-message=always" }) @AutoConfigureTestRestTemplate +@SuppressWarnings("removal") class SampleActuatorExtensionApplicationTests { @Autowired diff --git a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java index c2a2fe31e3b..4092432ca45 100644 --- a/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/CorsSampleActuatorApplicationTests.java @@ -44,6 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("cors") @AutoConfigureTestRestTemplate +@SuppressWarnings("removal") class CorsSampleActuatorApplicationTests { private TestRestTemplate testRestTemplate; diff --git a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java index a3ea2a1947d..303bc1269a6 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java @@ -62,6 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @ExtendWith(OutputCaptureExtension.class) @AutoConfigureTestRestTemplate +@SuppressWarnings("removal") class SampleTomcatApplicationTests { @Autowired diff --git a/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java index 4d6677f388e..aaf99a98955 100644 --- a/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java +++ b/system-test/spring-boot-deployment-system-tests/src/systemTest/java/org/springframework/boot/deployment/AbstractDeploymentTests.java @@ -43,6 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; /** * Abstract class for deployment tests. */ +@SuppressWarnings("removal") abstract class AbstractDeploymentTests { protected static final int DEFAULT_PORT = 8080;