我们使用 Spring boot 版本 2.3.1 也使用 WebClient
我的网络客户端配置:
private val client: WebClient
init {
val sslCtx = SslContextBuilder
.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.build()
val httpClient = HttpClient.create().secure { it.sslContext(sslCtx) }
val connector = ReactorClientHttpConnector(httpClient)
client = WebClient.builder()
.clientConnector(connector)
.baseUrl(URL)
.build()
}
private fun post(formData: MultiValueMap<String, String>, response: Class<out Response>, enableLog:
Boolean = true): Response? {
val inserts = BodyInserters.fromFormData(formData)
return try {
client
.post()
.body(inserts)
.retrieve()
.bodyToMono(response)
.block()
} catch (e: Exception) {
if (enableLog) {
log.error("Failed execute request: $formData", e)
}
throw e
}
}
当我尝试调试我的应用程序时,出现以下异常:
javax.net.ssl.SSLException:SSLEngine 已关闭
在 io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:848) ~[netty-handler-4.1.50.Final.jar:4.1.50.Final]
抑制:reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
在以下站点发现错误:
|_ checkpoint ⇢ 请求 POST null [DefaultWebClient]
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)