Skip to content

Commit 32f128b

Browse files
committed
Add create static factory method to WebClientAdapter
Closes gh-31120
1 parent dc7179c commit 32f128b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/function/client/support/WebClientAdapter.java

+13
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,20 @@ else if (requestValues instanceof ReactiveHttpRequestValues reactiveRequestValue
138138
* Create a {@link WebClientAdapter} for the given {@code WebClient} instance.
139139
* @param webClient the client to use
140140
* @return the created adapter instance
141+
* @since 6.1
141142
*/
143+
public static WebClientAdapter create(WebClient webClient) {
144+
return new WebClientAdapter(webClient);
145+
}
146+
147+
/**
148+
* Create a {@link WebClientAdapter} for the given {@code WebClient} instance.
149+
* @param webClient the client to use
150+
* @return the created adapter instance
151+
* @deprecated in favor of {@link #create(WebClient)} aligning with other adapter
152+
* implementations; to be removed in 6.2.
153+
*/
154+
@Deprecated(since = "6.1", forRemoval = true)
142155
public static WebClientAdapter forClient(WebClient webClient) {
143156
return new WebClientAdapter(webClient);
144157
}

Diff for: spring-webflux/src/test/java/org/springframework/web/reactive/function/client/support/WebClientAdapterTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private Service initService() {
163163
}
164164

165165
private Service initService(WebClient webClient) {
166-
WebClientAdapter adapter = WebClientAdapter.forClient(webClient);
166+
WebClientAdapter adapter = WebClientAdapter.create(webClient);
167167
return HttpServiceProxyFactory.builderFor(adapter).build().createClient(Service.class);
168168
}
169169

Diff for: spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/support/WebClientHttpServiceProxyKotlinTests.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class KotlinWebClientHttpServiceProxyTests {
128128
}
129129

130130
private fun initHttpService(webClient: WebClient): TestHttpService {
131-
val adapter = WebClientAdapter.forClient(webClient)
131+
val adapter = WebClientAdapter.create(webClient)
132132
return HttpServiceProxyFactory.builderFor(adapter).build().createClient()
133133
}
134134

0 commit comments

Comments
 (0)