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:
@@ -390,14 +390,10 @@ the `WebClient`:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
WebClient client = WebClient.builder()
|
||||
.baseUrl("https://api.github.com/")
|
||||
.build();
|
||||
WebClient client = WebClient.builder().baseUrl("https://api.github.com/").build();
|
||||
HttpServiceProxyFactory factory = WebClientAdapter.createHttpServiceProxyFactory(client)).build();
|
||||
|
||||
HttpServiceProxyFactory proxyFactory =
|
||||
HttpServiceProxyFactory.builder(new WebClientAdapter(client)).build();
|
||||
|
||||
RepositoryService service = proxyFactory.createClient(RepositoryService.class);
|
||||
RepositoryService service = factory.createClient(RepositoryService.class);
|
||||
----
|
||||
|
||||
An HTTP service interface can declare common attributes at the type level:
|
||||
|
||||
Reference in New Issue
Block a user