Add create static factory method to WebClientAdapter
Closes gh-31120
This commit is contained in:
parent
dc7179c528
commit
32f128b6ba
|
@ -138,7 +138,20 @@ public final class WebClientAdapter extends AbstractReactorHttpExchangeAdapter {
|
||||||
* Create a {@link WebClientAdapter} for the given {@code WebClient} instance.
|
* Create a {@link WebClientAdapter} for the given {@code WebClient} instance.
|
||||||
* @param webClient the client to use
|
* @param webClient the client to use
|
||||||
* @return the created adapter instance
|
* @return the created adapter instance
|
||||||
|
* @since 6.1
|
||||||
*/
|
*/
|
||||||
|
public static WebClientAdapter create(WebClient webClient) {
|
||||||
|
return new WebClientAdapter(webClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a {@link WebClientAdapter} for the given {@code WebClient} instance.
|
||||||
|
* @param webClient the client to use
|
||||||
|
* @return the created adapter instance
|
||||||
|
* @deprecated in favor of {@link #create(WebClient)} aligning with other adapter
|
||||||
|
* implementations; to be removed in 6.2.
|
||||||
|
*/
|
||||||
|
@Deprecated(since = "6.1", forRemoval = true)
|
||||||
public static WebClientAdapter forClient(WebClient webClient) {
|
public static WebClientAdapter forClient(WebClient webClient) {
|
||||||
return new WebClientAdapter(webClient);
|
return new WebClientAdapter(webClient);
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class WebClientAdapterTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Service initService(WebClient webClient) {
|
private Service initService(WebClient webClient) {
|
||||||
WebClientAdapter adapter = WebClientAdapter.forClient(webClient);
|
WebClientAdapter adapter = WebClientAdapter.create(webClient);
|
||||||
return HttpServiceProxyFactory.builderFor(adapter).build().createClient(Service.class);
|
return HttpServiceProxyFactory.builderFor(adapter).build().createClient(Service.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ class KotlinWebClientHttpServiceProxyTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initHttpService(webClient: WebClient): TestHttpService {
|
private fun initHttpService(webClient: WebClient): TestHttpService {
|
||||||
val adapter = WebClientAdapter.forClient(webClient)
|
val adapter = WebClientAdapter.create(webClient)
|
||||||
return HttpServiceProxyFactory.builderFor(adapter).build().createClient()
|
return HttpServiceProxyFactory.builderFor(adapter).build().createClient()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue