[英]Identifying UriBuilder implementation used by Spring WebClient
I use the below syntax to make a get call using get client.我使用以下语法使用 get 客户端进行 get 调用。 In the below example , which implementation of URIBuilder is being used and how is automatically inferenced?
在下面的示例中,正在使用 URIBuilder 的哪个实现以及如何自动推断?
webclient.get().uri(uriBuilder -> uriBuilder.path("/api/person/{personId}")
.queryParam("param1", aDouble)
.queryParam("param2", "A string value with spaces")
.queryParam("param3", aListOfValues)
.queryParam("param4", null)
.build(anInteger))
This is the webclient that I am using - WebClient这是我正在使用的网络客户端 - WebClient
You can decide which implementation is used WebClient
by providing a UriBuilderFactory
while building it.您可以通过在构建时提供
UriBuilderFactory
来决定使用WebClient
的实现。
The WebClient.Builder
has a uriBuilderFactory(UriBuilderFactory)
method where you can provide your implementation. WebClient.Builder
有一个uriBuilderFactory(UriBuilderFactory)
方法,您可以在其中提供您的实现。
If you don't provide one, it currently uses DefaultUriBuilderFactory
which produces UriComponentsBuilder
instances.如果您不提供,它当前使用
DefaultUriBuilderFactory
生成UriComponentsBuilder
实例。
You could always instrument your code to print uriBuilder.getClass()
for confirmation.您可以随时检测您的代码以打印
uriBuilder.getClass()
以进行确认。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.