Skip to content

Commit c71f98a

Browse files
committed
Merge branch '6.1.x'
2 parents 6174d95 + 321e8a5 commit c71f98a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@
1717
package org.springframework.web.client;
1818

1919
import java.io.IOException;
20+
import java.util.function.Predicate;
2021

2122
import org.springframework.http.client.ClientHttpResponse;
23+
import org.springframework.web.client.RestClient.ResponseSpec;
24+
import org.springframework.web.client.RestClient.ResponseSpec.ErrorHandler;
2225

2326
/**
2427
* A basic, no operation {@link ResponseErrorHandler} implementation suitable
25-
* for ignoring any error.
28+
* for ignoring any error using the {@link RestTemplate}.
29+
* <p>This implementation is not suitable with the {@link RestClient} as it uses
30+
* a list of candidates where the first matching is invoked. If you want to
31+
* disable default status handlers with the {@code RestClient}, consider
32+
* registering a noop {@link ResponseSpec.ErrorHandler ErrorHandler} with a
33+
* predicate that matches all status code, see
34+
* {@link RestClient.Builder#defaultStatusHandler(Predicate, ErrorHandler)}.
2635
*
2736
* @author Stephane Nicoll
2837
* @since 6.1.7

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

+4
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ Builder defaultStatusHandler(Predicate<HttpStatusCode> statusPredicate,
338338
* to apply to every response. Such default handlers are applied in the
339339
* order in which they are registered, and after any others that are
340340
* registered for a specific response.
341+
* <p>The first status handler who claims that a response has an
342+
* error is invoked. If you want to disable other defaults, consider
343+
* using {@link #defaultStatusHandler(Predicate, ResponseSpec.ErrorHandler)}
344+
* with a predicate that matches all status codes.
341345
* @param errorHandler handler that typically, though not necessarily,
342346
* throws an exception
343347
* @return this builder

0 commit comments

Comments
 (0)