Add Builder to HttpServiceProxyFactory
HttpServiceProxyFactory now support programmatic initialization through a builder, while bean-style initialization is deprecated. See gh-29296
This commit is contained in:
@@ -42,8 +42,7 @@ class CookieValueArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.afterPropertiesSet();
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class HttpMethodArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
proxyFactory.afterPropertiesSet();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class HttpServiceMethodTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
this.proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
this.proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
this.proxyFactory.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@@ -174,10 +174,10 @@ public class HttpServiceMethodTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void typeAndMethodAnnotatedService() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.setEmbeddedValueResolver(value -> (value.equals("${baseUrl}") ? "/base" : value));
|
||||
proxyFactory.afterPropertiesSet();
|
||||
void typeAndMethodAnnotatedService() {
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client)
|
||||
.embeddedValueResolver(value -> (value.equals("${baseUrl}") ? "/base" : value))
|
||||
.build();
|
||||
|
||||
MethodLevelAnnotatedService service = proxyFactory.createClient(TypeAndMethodLevelAnnotatedService.class);
|
||||
|
||||
|
||||
@@ -61,8 +61,9 @@ class NamedValueArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.addCustomArgumentResolver(this.argumentResolver);
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client)
|
||||
.customArgumentResolver(this.argumentResolver)
|
||||
.build();
|
||||
proxyFactory.afterPropertiesSet();
|
||||
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
|
||||
@@ -41,7 +41,7 @@ class PathVariableArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
proxyFactory.afterPropertiesSet();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ class RequestAttributeArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.afterPropertiesSet();
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,7 @@ public class RequestBodyArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.afterPropertiesSet();
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ class RequestHeaderArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.afterPropertiesSet();
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,7 @@ public class RequestParamArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.afterPropertiesSet();
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,7 @@ public class UrlArgumentResolverTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {
|
||||
HttpServiceProxyFactory proxyFactory = new HttpServiceProxyFactory(this.client);
|
||||
proxyFactory.afterPropertiesSet();
|
||||
HttpServiceProxyFactory proxyFactory = HttpServiceProxyFactory.builder(this.client).build();
|
||||
this.service = proxyFactory.createClient(Service.class);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user