Skip to content

Commit 233f755

Browse files
committed
Update Javadoc that links to RestTemplate
Ensure RestClient is mentioned where appropriate. Closes gh-34270
1 parent b026680 commit 233f755

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

spring-web/src/main/java/org/springframework/web/client/NoOpResponseErrorHandler.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525

2626
/**
2727
* A basic, no operation {@link ResponseErrorHandler} implementation suitable
28-
* for ignoring any error using the {@link RestTemplate}.
28+
* for ignoring any error using the {@link RestTemplate} or {@link RestClient}.
2929
* <p>This implementation is not suitable with the {@link RestClient} as it uses
3030
* a list of candidates where the first matching is invoked. If you want to
3131
* disable default status handlers with the {@code RestClient}, consider

spring-web/src/main/java/org/springframework/web/client/ResponseErrorHandler.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,8 +23,11 @@
2323
import org.springframework.http.client.ClientHttpResponse;
2424

2525
/**
26-
* Strategy interface used by the {@link RestTemplate} to determine
27-
* whether a particular response has an error or not.
26+
* Strategy interface used by the {@link RestTemplate} and {@link RestClient} to
27+
* determine whether a particular response has an error or not.
28+
*
29+
* <p>Note that {@code RestClient} also supports and recommends use of
30+
* {@link RestClient.ResponseSpec#onStatus status handlers}.
2831
*
2932
* @author Arjen Poutsma
3033
* @since 3.0

spring-web/src/main/java/org/springframework/web/client/RestClientException.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,15 +17,17 @@
1717
package org.springframework.web.client;
1818

1919
import org.springframework.core.NestedRuntimeException;
20-
import org.springframework.http.client.ClientHttpResponse;
2120
import org.springframework.lang.Nullable;
2221

2322
/**
24-
* Base class for exceptions thrown by {@link RestTemplate} in case a request
25-
* fails because of a server error response, as determined via
26-
* {@link ResponseErrorHandler#hasError(ClientHttpResponse)}, failure to decode
23+
* Base class for exceptions thrown by {@link RestClient} and {@link RestTemplate}
24+
* in case a request fails because of a server error response, a failure to decode
2725
* the response, or a low level I/O error.
2826
*
27+
* <p>Server error responses are determined by
28+
* {@link RestClient.ResponseSpec#onStatus status handlers} for {@code RestClient},
29+
* and by {@link ResponseErrorHandler} for {@code RestTemplate}.
30+
*
2931
* @author Arjen Poutsma
3032
* @since 3.0
3133
*/

spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -179,7 +179,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
179179

180180

181181
/**
182-
* Create a new instance of the {@link RestTemplate} using default settings.
182+
* Create a new instance with default settings.
183183
* Default {@link HttpMessageConverter HttpMessageConverters} are initialized.
184184
*/
185185
public RestTemplate() {
@@ -238,7 +238,7 @@ else if (kotlinSerializationCborPresent) {
238238
}
239239

240240
/**
241-
* Create a new instance of the {@link RestTemplate} based on the given {@link ClientHttpRequestFactory}.
241+
* Create a new instance with the given {@link ClientHttpRequestFactory}.
242242
* @param requestFactory the HTTP request factory to use
243243
* @see org.springframework.http.client.SimpleClientHttpRequestFactory
244244
* @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory
@@ -249,9 +249,8 @@ public RestTemplate(ClientHttpRequestFactory requestFactory) {
249249
}
250250

251251
/**
252-
* Create a new instance of the {@link RestTemplate} using the given list of
253-
* {@link HttpMessageConverter} to use.
254-
* @param messageConverters the list of {@link HttpMessageConverter} to use
252+
* Create a new instance with the given message converters.
253+
* @param messageConverters the list of converters to use
255254
* @since 3.2.7
256255
*/
257256
public RestTemplate(List<HttpMessageConverter<?>> messageConverters) {

0 commit comments

Comments
 (0)