Add HttpServiceProxyFactory builder
See gh-28386
This commit is contained in:
@@ -34,7 +34,7 @@ public class HttpMethodArgumentResolverTests {
|
||||
|
||||
private final TestHttpClientAdapter clientAdapter = new TestHttpClientAdapter();
|
||||
|
||||
private final Service service = this.clientAdapter.createService(Service.class, new HttpMethodArgumentResolver());
|
||||
private final Service service = this.clientAdapter.createService(Service.class);
|
||||
|
||||
|
||||
@Test
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.Optional;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.service.annotation.GetExchange;
|
||||
@@ -39,8 +38,7 @@ class PathVariableArgumentResolverTests {
|
||||
|
||||
private final TestHttpClientAdapter clientAdapter = new TestHttpClientAdapter();
|
||||
|
||||
private final Service service = this.clientAdapter.createService(
|
||||
Service.class, new PathVariableArgumentResolver(new DefaultConversionService()));
|
||||
private final Service service = this.clientAdapter.createService(Service.class);
|
||||
|
||||
|
||||
@Test
|
||||
|
||||
@@ -16,14 +16,10 @@
|
||||
|
||||
package org.springframework.web.service.invoker;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -53,11 +49,8 @@ class TestHttpClientAdapter implements HttpClientAdapter {
|
||||
/**
|
||||
* Create the proxy for the give service type.
|
||||
*/
|
||||
public <S> S createService(Class<S> serviceType, HttpServiceArgumentResolver... resolvers) {
|
||||
|
||||
HttpServiceProxyFactory factory = new HttpServiceProxyFactory(
|
||||
Arrays.asList(resolvers), this, ReactiveAdapterRegistry.getSharedInstance(), Duration.ofSeconds(5));
|
||||
|
||||
public <S> S createService(Class<S> serviceType) {
|
||||
HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(this).build();
|
||||
return factory.createClient(serviceType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user