Add static factory methods to WebClientAdapter

Ideally one would pass WebClient directly to HttpServiceProxyFactory,
but two need to remain decoupled. This commit adds static, shortcut
methods to WebClientAdapter to create an HttpServiceProxyFactory, thus
eliminating the step to wrap the WebClient.
This commit is contained in:
rstoyanchev
2022-06-23 12:34:29 +01:00
parent 45ee7913bf
commit b72ee5f034
4 changed files with 53 additions and 14 deletions

View File

@@ -50,6 +50,7 @@ import org.springframework.web.service.annotation.HttpExchange;
*
* @author Rossen Stoyanchev
* @since 6.0
* @see org.springframework.web.reactive.function.client.support.WebClientAdapter
*/
public final class HttpServiceProxyFactory implements InitializingBean, EmbeddedValueResolverAware {
@@ -75,6 +76,7 @@ public final class HttpServiceProxyFactory implements InitializingBean, Embedded
/**
* Create an instance with the underlying HTTP client to use.
* @param clientAdapter an adapter for the client
* @see org.springframework.web.reactive.function.client.support.WebClientAdapter#createHttpServiceProxyFactory(org.springframework.web.reactive.function.client.WebClient)
*/
public HttpServiceProxyFactory(HttpClientAdapter clientAdapter) {
Assert.notNull(clientAdapter, "HttpClientAdapter is required");