diff --git a/spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java b/spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java
index 32bd66ad932..9fac4754ab4 100644
--- a/spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java
+++ b/spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2025 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.
@@ -127,12 +127,6 @@ public final class MockServerRequest implements ServerRequest {
return this.method;
}
- @Override
- @Deprecated
- public String methodName() {
- return this.method.name();
- }
-
@Override
public URI uri() {
return this.uri;
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java
index 205f6bd3b6f..c488e497982 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2024 the original author or authors.
+ * Copyright 2002-2025 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.
@@ -129,27 +129,6 @@ public abstract class BodyInserters {
writeWithMessageWriters(message, context, Mono.just(body), ResolvableType.forType(bodyType), null);
}
- /**
- * Inserter to write the given object.
- *
Alternatively, consider using the {@code bodyValue(Object)} shortcuts on
- * {@link org.springframework.web.reactive.function.client.WebClient WebClient} and
- * {@link org.springframework.web.reactive.function.server.ServerResponse ServerResponse}.
- * @param body the body to write to the response
- * @param the type of the body
- * @return the inserter to write a single object
- * @throws IllegalArgumentException if {@code body} is a {@link Publisher} or an
- * instance of a type supported by {@link ReactiveAdapterRegistry#getSharedInstance()},
- * for which {@link #fromPublisher(Publisher, Class)} or
- * {@link #fromProducer(Object, Class)} should be used.
- * @see #fromPublisher(Publisher, Class)
- * @see #fromProducer(Object, Class)
- * @deprecated As of Spring Framework 5.2, in favor of {@link #fromValue(Object)}
- */
- @Deprecated
- public static BodyInserter fromObject(T body) {
- return fromValue(body);
- }
-
/**
* Inserter to write the given producer of value(s) which must be a {@link Publisher}
* or another producer adaptable to a {@code Publisher} via
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientRequest.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientRequest.java
index 3a698356b53..81837665650 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientRequest.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2021 the original author or authors.
+ * Copyright 2002-2025 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.
@@ -133,18 +133,6 @@ public interface ClientRequest {
return new DefaultClientRequestBuilder(other);
}
- /**
- * Create a builder with the given HTTP method and url.
- * @param method the HTTP method (GET, POST, etc)
- * @param url the url (as a URI instance)
- * @return the created builder
- * @deprecated in favor of {@link #create(HttpMethod, URI)}
- */
- @Deprecated
- static Builder method(HttpMethod method, URI url) {
- return new DefaultClientRequestBuilder(method, url);
- }
-
/**
* Create a request builder with the given HTTP method and url.
* @param method the HTTP method (GET, POST, etc)
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java
index 9f076f3e4fb..d781ef28c2c 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2024 the original author or authors.
+ * Copyright 2002-2025 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.
@@ -211,21 +211,6 @@ public interface ClientResponse {
// Static builder methods
- /**
- * Create a builder with the status, headers, and cookies of the given response.
- * Note: Note that the body in the returned builder is
- * {@link Flux#empty()} by default. To carry over the one from the original
- * response, use {@code otherResponse.bodyToFlux(DataBuffer.class)} or
- * simply use the instance based {@link #mutate()} method.
- * @param other the response to copy the status, headers, and cookies from
- * @return the created builder
- * @deprecated as of 5.3 in favor of the instance based {@link #mutate()}.
- */
- @Deprecated
- static Builder from(ClientResponse other) {
- return new DefaultClientResponseBuilder(other, false);
- }
-
/**
* Create a response builder with the given status code and using default strategies for
* reading the body.
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java
index 9b32b5bae69..b254e8ef306 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java
@@ -39,7 +39,6 @@ import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.publisher.SignalType;
-import reactor.util.context.Context;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
@@ -207,8 +206,6 @@ final class DefaultWebClient implements WebClient {
private final Map attributes = new LinkedHashMap<>(4);
- private @Nullable Function contextModifier;
-
private @Nullable Consumer httpRequestConsumer;
DefaultRequestBodyUriSpec(HttpMethod httpMethod) {
@@ -335,14 +332,6 @@ final class DefaultWebClient implements WebClient {
return this;
}
- @SuppressWarnings("deprecation")
- @Override
- public RequestBodySpec context(Function contextModifier) {
- this.contextModifier = (this.contextModifier != null ?
- this.contextModifier.andThen(contextModifier) : contextModifier);
- return this;
- }
-
@Override
public RequestBodySpec httpRequest(Consumer requestConsumer) {
this.httpRequestConsumer = (this.httpRequestConsumer != null ?
@@ -393,12 +382,6 @@ final class DefaultWebClient implements WebClient {
return this;
}
- @Override
- @Deprecated
- public RequestHeadersSpec> syncBody(Object body) {
- return bodyValue(body);
- }
-
@Override
public ResponseSpec retrieve() {
return new DefaultResponseSpec(
@@ -434,9 +417,7 @@ final class DefaultWebClient implements WebClient {
});
}
- @SuppressWarnings("deprecation")
- @Override
- public Mono exchange() {
+ private Mono exchange() {
ClientRequest.Builder requestBuilder = initRequestBuilder();
ClientRequestObservationContext observationContext = new ClientRequestObservationContext(requestBuilder);
return Mono.deferContextual(contextView -> {
@@ -459,9 +440,6 @@ final class DefaultWebClient implements WebClient {
WebClientUtils.getRequestDescription(request.method(), request.url()) +
" [DefaultWebClient]")
.switchIfEmpty(NO_HTTP_CLIENT_RESPONSE_ERROR);
- if (this.contextModifier != null) {
- responseMono = responseMono.contextWrite(this.contextModifier);
- }
final AtomicBoolean responseReceived = new AtomicBoolean();
return responseMono
.doOnNext(response -> responseReceived.set(true))
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java
index 867bc97e547..6318e3d739f 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2025 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.
@@ -251,16 +251,6 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
return this;
}
- @Override
- @Deprecated
- public WebClient.Builder exchangeStrategies(Consumer configurer) {
- if (this.strategiesConfigurers == null) {
- this.strategiesConfigurers = new ArrayList<>(4);
- }
- this.strategiesConfigurers.add(configurer);
- return this;
- }
-
@Override
public WebClient.Builder exchangeFunction(ExchangeFunction exchangeFunction) {
this.exchangeFunction = exchangeFunction;
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
index 991485f5e10..f51f15babbb 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2025 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.
@@ -17,12 +17,9 @@
package org.springframework.web.reactive.function.client;
import java.nio.charset.Charset;
-import java.util.Map;
-import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
-import org.jspecify.annotations.Nullable;
import reactor.core.publisher.Mono;
import org.springframework.core.io.buffer.DataBufferUtils;
@@ -41,13 +38,6 @@ import org.springframework.util.Assert;
*/
public abstract class ExchangeFilterFunctions {
- /**
- * Name of the request attribute with {@link Credentials} for {@link #basicAuthentication()}.
- */
- private static final String BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE =
- ExchangeFilterFunctions.class.getName() + ".basicAuthenticationCredentials";
-
-
/**
* Consume up to the specified number of bytes from the response body and
* cancel if any more data arrives.
@@ -100,81 +90,4 @@ public abstract class ExchangeFilterFunctions {
.build());
}
- /**
- * Variant of {@link #basicAuthentication(String, String)} that looks up
- * the {@link Credentials Credentials} in a
- * {@link #BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE request attribute}.
- * @return the filter to use
- * @see Credentials
- * @deprecated as of Spring 5.1 in favor of using
- * {@link HttpHeaders#setBasicAuth(String, String)} while building the request.
- */
- @Deprecated
- public static ExchangeFilterFunction basicAuthentication() {
- return (request, next) -> {
- Object attr = request.attributes().get(BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE);
- if (attr instanceof Credentials cred) {
- return next.exchange(ClientRequest.from(request)
- .headers(headers -> headers.setBasicAuth(cred.username, cred.password))
- .build());
- }
- else {
- return next.exchange(request);
- }
- };
- }
-
-
- /**
- * Stores username and password for HTTP basic authentication.
- * @deprecated as of Spring 5.1 in favor of using
- * {@link HttpHeaders#setBasicAuth(String, String)} while building the request.
- */
- @Deprecated
- public static final class Credentials {
-
- private final String username;
-
- private final String password;
-
- /**
- * Create a new {@code Credentials} instance with the given username and password.
- * @param username the username
- * @param password the password
- */
- public Credentials(String username, String password) {
- Assert.notNull(username, "'username' must not be null");
- Assert.notNull(password, "'password' must not be null");
- this.username = username;
- this.password = password;
- }
-
- /**
- * Return a {@literal Consumer} that stores the given username and password
- * as a request attribute of type {@code Credentials} that is in turn
- * used by {@link ExchangeFilterFunctions#basicAuthentication()}.
- * @param username the username
- * @param password the password
- * @return a consumer that can be passed into
- * {@linkplain ClientRequest.Builder#attributes(java.util.function.Consumer)}
- * @see ClientRequest.Builder#attributes(java.util.function.Consumer)
- * @see #BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
- */
- public static Consumer