Add cloneBuilder method on WebClient.Builder
This commit adds a new `cloneBuilder()` method on `WebClient.Builder`; we can now reuse the customizations of an existing builder without sharing its state across several `WebClient` building code paths. Issue: SPR-15690
This commit is contained in:
committed by
Rossen Stoyanchev
parent
8fc3b3bc37
commit
8ac29c8ce7
@@ -92,6 +92,11 @@ class DefaultWebClientBuilder implements WebClient.Builder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebClient.Builder cloneBuilder() {
|
||||
return new DefaultWebClientBuilder(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebClient.Builder defaultUriVariables(Map<String, ?> defaultUriVariables) {
|
||||
this.defaultUriVariables = defaultUriVariables;
|
||||
|
||||
@@ -192,6 +192,11 @@ public interface WebClient {
|
||||
*/
|
||||
Builder baseUrl(String baseUrl);
|
||||
|
||||
/**
|
||||
* Clone this {@code WebClient.Builder}
|
||||
*/
|
||||
Builder cloneBuilder();
|
||||
|
||||
/**
|
||||
* Configure default URI variable values that will be used when expanding
|
||||
* URI templates using a {@link Map}.
|
||||
|
||||
Reference in New Issue
Block a user