Skip to content

Commit ade8128

Browse files
committed
Remove deprecated methods
Closes gh-33123
1 parent 9409543 commit ade8128

File tree

8 files changed

+10
-290
lines changed

8 files changed

+10
-290
lines changed

spring-web/src/main/java/org/springframework/web/bind/MethodArgumentNotValidException.java

+1-43
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -16,16 +16,13 @@
1616

1717
package org.springframework.web.bind;
1818

19-
import java.util.List;
2019
import java.util.Locale;
21-
import java.util.Map;
2220

2321
import org.springframework.context.MessageSource;
2422
import org.springframework.core.MethodParameter;
2523
import org.springframework.http.HttpStatus;
2624
import org.springframework.http.HttpStatusCode;
2725
import org.springframework.http.ProblemDetail;
28-
import org.springframework.lang.Nullable;
2926
import org.springframework.validation.BindException;
3027
import org.springframework.validation.BindingResult;
3128
import org.springframework.validation.ObjectError;
@@ -92,45 +89,6 @@ public Object[] getDetailMessageArguments() {
9289
BindErrorUtils.resolveAndJoin(getFieldErrors())};
9390
}
9491

95-
/**
96-
* Convert each given {@link ObjectError} to a String.
97-
* @since 6.0
98-
* @deprecated in favor of using {@link BindErrorUtils} and
99-
* {@link #getAllErrors()}, to be removed in 6.2
100-
*/
101-
@Deprecated(since = "6.1", forRemoval = true)
102-
public static List<String> errorsToStringList(List<? extends ObjectError> errors) {
103-
return BindErrorUtils.resolve(errors).values().stream().toList();
104-
}
105-
106-
/**
107-
* Convert each given {@link ObjectError} to a String, and use a
108-
* {@link MessageSource} to resolve each error.
109-
* @since 6.0
110-
* @deprecated in favor of {@link BindErrorUtils}, to be removed in 6.2
111-
*/
112-
@Deprecated(since = "6.1", forRemoval = true)
113-
public static List<String> errorsToStringList(
114-
List<? extends ObjectError> errors, @Nullable MessageSource messageSource, Locale locale) {
115-
116-
return (messageSource != null ?
117-
BindErrorUtils.resolve(errors, messageSource, locale).values().stream().toList() :
118-
BindErrorUtils.resolve(errors).values().stream().toList());
119-
}
120-
121-
/**
122-
* Resolve global and field errors to messages with the given
123-
* {@link MessageSource} and {@link Locale}.
124-
* @return a Map with errors as keys and resolved messages as values
125-
* @since 6.0.3
126-
* @deprecated in favor of using {@link BindErrorUtils} and
127-
* {@link #getAllErrors()}, to be removed in 6.2
128-
*/
129-
@Deprecated(since = "6.1", forRemoval = true)
130-
public Map<ObjectError, String> resolveErrorMessages(MessageSource messageSource, Locale locale) {
131-
return BindErrorUtils.resolve(getAllErrors(), messageSource, locale);
132-
}
133-
13492
@Override
13593
public String getMessage() {
13694
StringBuilder sb = new StringBuilder("Validation failed for argument [")

spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeBindException.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -78,19 +78,6 @@ public Object[] getDetailMessageArguments(MessageSource source, Locale locale) {
7878
BindErrorUtils.resolveAndJoin(getFieldErrors(), source, locale)};
7979
}
8080

81-
/**
82-
* Resolve global and field errors to messages with the given
83-
* {@link MessageSource} and {@link Locale}.
84-
* @return a Map with errors as key and resolves messages as value
85-
* @since 6.0.3
86-
* @deprecated in favor of using {@link BindErrorUtils} and
87-
* {@link #getAllErrors()}, to be removed in 6.2
88-
*/
89-
@Deprecated(since = "6.1", forRemoval = true)
90-
public Map<ObjectError, String> resolveErrorMessages(MessageSource messageSource, Locale locale) {
91-
return BindErrorUtils.resolve(getAllErrors(), messageSource, locale);
92-
}
93-
9481

9582
// BindingResult implementation methods
9683

spring-web/src/main/java/org/springframework/web/service/invoker/HttpRequestValues.java

+1-86
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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,10 +23,6 @@
2323
import java.util.List;
2424
import java.util.Map;
2525

26-
import org.reactivestreams.Publisher;
27-
28-
import org.springframework.core.ParameterizedTypeReference;
29-
import org.springframework.core.ResolvableType;
3026
import org.springframework.http.HttpEntity;
3127
import org.springframework.http.HttpHeaders;
3228
import org.springframework.http.HttpMethod;
@@ -80,22 +76,6 @@ public class HttpRequestValues {
8076
private final Object bodyValue;
8177

8278

83-
/**
84-
* Constructor without UriBuilderFactory.
85-
* @deprecated in favour of
86-
* {@link HttpRequestValues#HttpRequestValues(HttpMethod, URI, UriBuilderFactory, String, Map, HttpHeaders, MultiValueMap, Map, Object)}
87-
* to be removed in 6.2.
88-
*/
89-
@Deprecated(since = "6.1", forRemoval = true)
90-
protected HttpRequestValues(@Nullable HttpMethod httpMethod,
91-
@Nullable URI uri, @Nullable String uriTemplate,
92-
Map<String, String> uriVariables,
93-
HttpHeaders headers, MultiValueMap<String, String> cookies, Map<String, Object> attributes,
94-
@Nullable Object bodyValue) {
95-
96-
this(httpMethod, uri, null, uriTemplate, uriVariables, headers, cookies, attributes, bodyValue);
97-
}
98-
9979
/**
10080
* Construct {@link HttpRequestValues}.
10181
* @since 6.1
@@ -197,30 +177,6 @@ public Object getBodyValue() {
197177
return this.bodyValue;
198178
}
199179

200-
/**
201-
* Return the request body as a Publisher.
202-
* <p>This is mutually exclusive with {@link #getBodyValue()}.
203-
* Only one of the two or neither is set.
204-
* @deprecated in favor of {@link ReactiveHttpRequestValues#getBodyPublisher()};
205-
* to be removed in 6.2
206-
*/
207-
@Deprecated(since = "6.1", forRemoval = true)
208-
@Nullable
209-
public Publisher<?> getBody() {
210-
throw new UnsupportedOperationException();
211-
}
212-
213-
/**
214-
* Return the element type for a Publisher body.
215-
* @deprecated in favor of {@link ReactiveHttpRequestValues#getBodyPublisherElementType()};
216-
* to be removed in 6.2
217-
*/
218-
@Deprecated(since = "6.1", forRemoval = true)
219-
@Nullable
220-
public ParameterizedTypeReference<?> getBodyElementType() {
221-
throw new UnsupportedOperationException();
222-
}
223-
224180

225181
public static Builder builder() {
226182
return new Builder();
@@ -383,17 +339,6 @@ public Builder addRequestPart(String name, Object part) {
383339
return this;
384340
}
385341

386-
/**
387-
* Variant of {@link #addRequestPart(String, Object)} that allows the
388-
* part value to be produced by a {@link Publisher}.
389-
* @deprecated in favor of {@link ReactiveHttpRequestValues.Builder#addRequestPartPublisher};
390-
* to be removed in 6.2
391-
*/
392-
@Deprecated(since = "6.1", forRemoval = true)
393-
public <T, P extends Publisher<T>> Builder addRequestPart(String name, P publisher, ResolvableType type) {
394-
throw new UnsupportedOperationException();
395-
}
396-
397342
/**
398343
* Configure an attribute to associate with the request.
399344
* @param name the attribute name
@@ -412,18 +357,6 @@ public void setBodyValue(@Nullable Object bodyValue) {
412357
this.bodyValue = bodyValue;
413358
}
414359

415-
/**
416-
* Set the request body as a Reactive Streams Publisher.
417-
* <p>This is mutually exclusive with, and resets any previously set
418-
* {@linkplain #setBodyValue(Object) body value}.
419-
* @deprecated in favor of {@link ReactiveHttpRequestValues.Builder#setBodyPublisher};
420-
* to be removed in 6.2
421-
*/
422-
@Deprecated(since = "6.1", forRemoval = true)
423-
public <T, P extends Publisher<T>> void setBody(P body, ParameterizedTypeReference<T> elementTye) {
424-
throw new UnsupportedOperationException();
425-
}
426-
427360
/**
428361
* Build the {@link HttpRequestValues} instance.
429362
*/
@@ -513,24 +446,6 @@ private String appendQueryParams(
513446
return uriComponentsBuilder.build().toUriString();
514447
}
515448

516-
/**
517-
* Create {@link HttpRequestValues} from values passed to the {@link Builder}.
518-
* @deprecated in favour of
519-
* {@link Builder#createRequestValues(HttpMethod, URI, UriBuilderFactory, String, Map, HttpHeaders, MultiValueMap, Map, Object)}
520-
* to be removed in 6.2.
521-
*/
522-
@Deprecated(since = "6.1", forRemoval = true)
523-
protected HttpRequestValues createRequestValues(
524-
@Nullable HttpMethod httpMethod,
525-
@Nullable URI uri, @Nullable String uriTemplate,
526-
Map<String, String> uriVars,
527-
HttpHeaders headers, MultiValueMap<String, String> cookies, Map<String, Object> attributes,
528-
@Nullable Object bodyValue) {
529-
530-
return createRequestValues(httpMethod, uri, null, uriTemplate,
531-
uriVars, headers, cookies, attributes, bodyValue);
532-
}
533-
534449
/**
535450
* Create {@link HttpRequestValues} from values passed to the {@link Builder}.
536451
* @since 6.1

spring-web/src/main/java/org/springframework/web/service/invoker/HttpServiceProxyFactory.java

+1-62
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -18,7 +18,6 @@
1818

1919
import java.lang.reflect.InvocationHandler;
2020
import java.lang.reflect.Method;
21-
import java.time.Duration;
2221
import java.util.ArrayList;
2322
import java.util.List;
2423
import java.util.Map;
@@ -32,7 +31,6 @@
3231
import org.springframework.aop.framework.ReflectiveMethodInvocation;
3332
import org.springframework.core.KotlinDetector;
3433
import org.springframework.core.MethodIntrospector;
35-
import org.springframework.core.ReactiveAdapterRegistry;
3634
import org.springframework.core.annotation.AnnotatedElementUtils;
3735
import org.springframework.core.convert.ConversionService;
3836
import org.springframework.format.support.DefaultFormattingConversionService;
@@ -112,17 +110,6 @@ public static Builder builderFor(HttpExchangeAdapter exchangeAdapter) {
112110
return new Builder().exchangeAdapter(exchangeAdapter);
113111
}
114112

115-
/**
116-
* Return a builder that's initialized with the given client.
117-
* @deprecated in favor of {@link #builderFor(HttpExchangeAdapter)};
118-
* to be removed in 6.2.
119-
*/
120-
@SuppressWarnings("removal")
121-
@Deprecated(since = "6.1", forRemoval = true)
122-
public static Builder builder(HttpClientAdapter clientAdapter) {
123-
return new Builder().exchangeAdapter(clientAdapter.asReactorExchangeAdapter());
124-
}
125-
126113
/**
127114
* Return an empty builder, with the client to be provided to builder.
128115
*/
@@ -161,20 +148,6 @@ public Builder exchangeAdapter(HttpExchangeAdapter adapter) {
161148
return this;
162149
}
163150

164-
/**
165-
* Provide the HTTP client to perform requests through.
166-
* @param clientAdapter a client adapted to {@link HttpClientAdapter}
167-
* @return this same builder instance
168-
* @deprecated in favor of {@link #exchangeAdapter(HttpExchangeAdapter)};
169-
* to be removed in 6.2
170-
*/
171-
@SuppressWarnings("removal")
172-
@Deprecated(since = "6.1", forRemoval = true)
173-
public Builder clientAdapter(HttpClientAdapter clientAdapter) {
174-
this.exchangeAdapter = clientAdapter.asReactorExchangeAdapter();
175-
return this;
176-
}
177-
178151
/**
179152
* Register a custom argument resolver, invoked ahead of default resolvers.
180153
* @param resolver the resolver to add
@@ -207,40 +180,6 @@ public Builder embeddedValueResolver(StringValueResolver embeddedValueResolver)
207180
return this;
208181
}
209182

210-
/**
211-
* Set the {@link ReactiveAdapterRegistry} to use to support different
212-
* asynchronous types for HTTP service method return values.
213-
* <p>By default this is {@link ReactiveAdapterRegistry#getSharedInstance()}.
214-
* @return this same builder instance
215-
* @deprecated in favor of setting the same directly on the {@link HttpExchangeAdapter}
216-
*/
217-
@Deprecated(since = "6.1", forRemoval = true)
218-
public Builder reactiveAdapterRegistry(ReactiveAdapterRegistry registry) {
219-
if (this.exchangeAdapter instanceof AbstractReactorHttpExchangeAdapter settable) {
220-
settable.setReactiveAdapterRegistry(registry);
221-
}
222-
return this;
223-
}
224-
225-
/**
226-
* Configure how long to block for the response of an HTTP service method
227-
* with a synchronous (blocking) method signature.
228-
* <p>By default this is not set, in which case the behavior depends on
229-
* connection and request timeout settings of the underlying HTTP client.
230-
* We recommend configuring timeout values directly on the underlying HTTP
231-
* client, which provides more control over such settings.
232-
* @param blockTimeout the timeout value
233-
* @return this same builder instance
234-
* @deprecated in favor of setting the same directly on the {@link HttpExchangeAdapter}
235-
*/
236-
@Deprecated(since = "6.1", forRemoval = true)
237-
public Builder blockTimeout(@Nullable Duration blockTimeout) {
238-
if (this.exchangeAdapter instanceof AbstractReactorHttpExchangeAdapter settable) {
239-
settable.setBlockTimeout(blockTimeout);
240-
}
241-
return this;
242-
}
243-
244183
/**
245184
* Build the {@link HttpServiceProxyFactory} instance.
246185
*/

spring-web/src/main/java/org/springframework/web/service/invoker/ReactiveHttpRequestValues.java

-35
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.reactivestreams.Publisher;
2424

2525
import org.springframework.core.ParameterizedTypeReference;
26-
import org.springframework.core.ResolvableType;
2726
import org.springframework.http.HttpHeaders;
2827
import org.springframework.http.HttpMethod;
2928
import org.springframework.http.MediaType;
@@ -80,28 +79,6 @@ public ParameterizedTypeReference<?> getBodyPublisherElementType() {
8079
return this.bodyElementType;
8180
}
8281

83-
/**
84-
* Return the request body as a {@link Publisher}.
85-
* <p>This is mutually exclusive with {@link #getBodyValue()}.
86-
* Only one of the two or neither is set.
87-
*/
88-
@Override
89-
@SuppressWarnings("removal")
90-
@Nullable
91-
public Publisher<?> getBody() {
92-
return getBodyPublisher();
93-
}
94-
95-
/**
96-
* Return the element type for a {@linkplain #getBodyPublisher() body publisher}.
97-
*/
98-
@Override
99-
@SuppressWarnings("removal")
100-
@Nullable
101-
public ParameterizedTypeReference<?> getBodyElementType() {
102-
return getBodyPublisherElementType();
103-
}
104-
10582

10683
public static Builder builder() {
10784
return new Builder();
@@ -211,12 +188,6 @@ public <T, P extends Publisher<T>> Builder addRequestPartPublisher(
211188
return this;
212189
}
213190

214-
@SuppressWarnings("removal")
215-
@Override
216-
public <T, P extends Publisher<T>> Builder addRequestPart(String name, P publisher, ResolvableType type) {
217-
return addRequestPartPublisher(name, publisher, ParameterizedTypeReference.forType(type.getType()));
218-
}
219-
220191
/**
221192
* {@inheritDoc}
222193
* <p>This is mutually exclusive with and resets any previously set
@@ -242,12 +213,6 @@ public <T, P extends Publisher<T>> void setBodyPublisher(P body, ParameterizedTy
242213
super.setBodyValue(null);
243214
}
244215

245-
@SuppressWarnings("removal")
246-
@Override
247-
public <T, P extends Publisher<T>> void setBody(P body, ParameterizedTypeReference<T> elementTye) {
248-
setBodyPublisher(body, elementTye);
249-
}
250-
251216
@Override
252217
public ReactiveHttpRequestValues build() {
253218
return (ReactiveHttpRequestValues) super.build();

0 commit comments

Comments
 (0)