Make RestTemplateBuilder more compatible with RestClient.Builder
When Spring Framework builds a `RestClient` from a `RestTemplate`, it will use any `UriTemplateHandler` that has been set on the `RestTemplate` if the provided `UriTemplateHandler` is also a `UriBuilderFactory`. Prior to this commit, Spring Boot's `RestTemplateBuilder#rootUri` set a `UriTemplateHandler` on the created `RestTemplate`, but it was not a `UriBuilderFactory` so `RestClient` would not consider it. With this commit, `RestTemplateBuilder#rootUri` sets a `UriTemplateHandler` that is also a `UriBuilderFactory` so that any root URI that is set on the `RestTemplateBuilder` will be applied to a `RestClient` also. Fixes gh-39317
This commit is contained in:
@@ -171,8 +171,8 @@ public class TestRestTemplate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root URI applied by a {@link RootUriTemplateHandler} or {@code ""} if
|
||||
* the root URI is not available.
|
||||
* Returns the root URI applied by {@link RestTemplateBuilder#rootUri(String)} or
|
||||
* {@code ""} if the root URI has not been applied.
|
||||
* @return the root URI
|
||||
*/
|
||||
public String getRootUri() {
|
||||
|
||||
Reference in New Issue
Block a user