From 50ef3b0a2996dc7b5d1155bf10d342fedfbf5871 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Thu, 19 Feb 2026 11:42:22 +0000 Subject: [PATCH] Update Javadoc of RestClient.Builder defaultStatusHandler See gh-36248 --- .../web/client/RestClient.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/client/RestClient.java b/spring-web/src/main/java/org/springframework/web/client/RestClient.java index e45526ee1ab..5fa7f8ee822 100644 --- a/spring-web/src/main/java/org/springframework/web/client/RestClient.java +++ b/spring-web/src/main/java/org/springframework/web/client/RestClient.java @@ -353,17 +353,14 @@ public interface RestClient { ResponseSpec.ErrorHandler errorHandler); /** - * Register a default - * {@linkplain ResponseSpec#onStatus(ResponseErrorHandler) status handler} - * to apply to every response. Such default handlers are applied in the - * order in which they are registered, and after any others that are - * registered for a specific response. - *

The first status handler who claims that a response has an - * error is invoked. If you want to disable other defaults, consider - * using {@link #defaultStatusHandler(Predicate, ResponseSpec.ErrorHandler)} - * with a predicate that matches all status codes. - * @param errorHandler handler that typically, though not necessarily, - * throws an exception + * Variant of {@link #defaultStatusHandler(Predicate, ResponseSpec.ErrorHandler)} + * that allows use of {@code RestTemplate}'s {@code ResponseErrorHandler} + * mechanism. This is provided mainly to assist {@code RestTemplate} + * users to transition to {@link RestClient}. Internally, the given + * handler is adapted to {@link RestClient.ResponseSpec}, which is the + * preferred mechanism to use. + * @param errorHandler the error handler to configure, internally adapted + * and integrated into the {@link ResponseSpec.ErrorHandler} chain. * @return this builder */ Builder defaultStatusHandler(ResponseErrorHandler errorHandler);