Skip to content

Commit 93f0169

Browse files
author
Vincent Potucek
committed
Issue spring-projects#46632: Deprecate TestRestTemplate
1 parent 7878407 commit 93f0169

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client

module/spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client/TestRestTemplate.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.springframework.http.RequestEntity;
5353
import org.springframework.http.RequestEntity.UriTemplateRequestEntity;
5454
import org.springframework.http.ResponseEntity;
55+
import org.springframework.test.web.servlet.client.RestTestClient;
5556
import org.springframework.util.Assert;
5657
import org.springframework.util.ObjectUtils;
5758
import org.springframework.web.client.NoOpResponseErrorHandler;
@@ -81,6 +82,8 @@
8182
* your test. If you need customizations (for example to adding additional message
8283
* converters) use a {@link RestTemplateBuilder} {@code @Bean}.
8384
*
85+
* @deprecated {@link RestTestClient} is considered successor.
86+
*
8487
* @author Dave Syer
8588
* @author Phillip Webb
8689
* @author Andy Wilkinson
@@ -1017,11 +1020,11 @@ private URI resolveUri(RequestEntity<?> entity) {
10171020
if (entity instanceof UriTemplateRequestEntity<?> templatedUriEntity) {
10181021
if (templatedUriEntity.getVars() != null) {
10191022
return this.restTemplate.getUriTemplateHandler()
1020-
.expand(templatedUriEntity.getUriTemplate(), templatedUriEntity.getVars());
1023+
.expand(templatedUriEntity.getUriTemplate(), templatedUriEntity.getVars());
10211024
}
10221025
else if (templatedUriEntity.getVarsMap() != null) {
10231026
return this.restTemplate.getUriTemplateHandler()
1024-
.expand(templatedUriEntity.getUriTemplate(), templatedUriEntity.getVarsMap());
1027+
.expand(templatedUriEntity.getUriTemplate(), templatedUriEntity.getVarsMap());
10251028
}
10261029
throw new IllegalStateException(
10271030
"No variables specified for URI template: " + templatedUriEntity.getUriTemplate());
@@ -1065,7 +1068,8 @@ public TlsSocketStrategy getTlsSocketStrategy(@Nullable SslBundle sslBundle) {
10651068
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, trustStrategy).build();
10661069
return new DefaultClientTlsStrategy(sslContext, SUPPORTED_PROTOCOLS, null, null, null);
10671070
}
1068-
catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException ex) {
1071+
catch (KeyManagementException | NoSuchAlgorithmException |
1072+
KeyStoreException ex) {
10691073
throw new IllegalStateException(ex);
10701074
}
10711075
}

0 commit comments

Comments
 (0)