如何解决春季WebClient:SSLEngine已关闭
我们使用的是Spring Boot 2.3.1版,也使用了WebClient
我的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: 在以下站点发现了错误: | _检查点⇢请求POST空[DefaultWebClient]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。