项目里需要忽略证书访问,在网上查了,大部分回答都是复制粘贴的,并且也没有什么结果。
自己看看源码,现在把创建忽略证书的CloseableHttpClient的方法共享下
public CloseableHttpClient getIgnoeSSLClient() throws Exception { SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, new TrustStrategy() { @Override public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {