Java特定的WebClient连接超时每个请求超时
我必须调用具有WebClient的不同连接超时的不同URL。但是我发现我们只能在全球范围内设置连接超时,而不是每个倒置。
I have to call different urls with different connection timeout with webclient. But i found that we can set connect timeout globally only and not per resquest .. what to do please to set this timeout on a request without creating a new weblient each time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
超时()
单声道use
timeout()
of Mono您需要每个URL实例化一个WebClient。对于每个WebClient,您可以设置连接超时:
然后将此网络电量重复使用为已配置的URL的所有调用。
You need to instantiate one webclient per url. For each webclient, you can set the connection timeout :
Then reuse this webclient for all the calls to the configured url.