我正在使用Spring asyncresttempate同时调用多个服务。这些服务是通过SSL公开的。能告诉我如何使用SSL证书和AsyncResttemplate来异步调用服务吗?我们可以在HttpConnectionFactory中使用RestTemplate,如何对AsyncRestTemplate做同样的事情。
我使用的是Spring4.3,JDK 8。
发布于 2017-08-25 04:41:07
您可以使用AsyncClientHttpRequestFactory:
CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
.setSSLHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)
.setSSLContext(getSSLCOntext(keyStore)).build();
AsyncClientHttpRequestFactory reqFactory =
new HttpComponentsAsyncClientHttpRequestFactory(httpclient);
AsyncRestTemplate restTemplate = new AsyncRestTemplate(reqFactory);https://stackoverflow.com/questions/45361960
复制相似问题