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

@@ -106,10 +106,9 @@ public class WebClientHttpServiceProxyTests {
}
private TestHttpService initHttpService(WebClient webClient) throws Exception {
WebClientAdapter client = new WebClientAdapter(webClient);
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(client);
proxyFactory.afterPropertiesSet();
return proxyFactory.createClient(TestHttpService.class);
HttpServiceProxyFactory factory = WebClientAdapter.createHttpServiceProxyFactory(webClient);
factory.afterPropertiesSet();
return factory.createClient(TestHttpService.class);
}
private void prepareResponse(Consumer<MockResponse> consumer) {