SSLContextBuilder和SSLContexts已经被弃用。

24

我正在使用JDK1.8,JDK兼容性为JavaSE-1.7,Eclipse Luna和Apache httpclient 4.4.1。

在Eclipse中,我收到了一个警告,称sslcontextbuilderSSLContexts已被弃用。这些类的替代方案是什么?


你是否在使用OpenJDK? - rsilva4
1
请问您能否提供更多信息?您使用的是哪个版本的Eclipse、JDK和库? - Uwe Plonus
我正在使用JDK1.8,与JDK Compilance JavaSE-1.7、Eclipse Luna和Apache httpclient 4.4.1版本。 - Viraj
2个回答

42

我刚刚看了一下,似乎 HttpCLient SSLContexts 类正在从 org.apache.http.conn.ssl.SSLContexts 移动到 org.apache.http.ssl.SSLContexts。我将我的导入更改为这些新包,现在看起来很好。不确定你对 sslcontextbuilder 的参考是什么,但我相信它也有另一种实现方式。让我知道更多细节,我可以检查。


1
您可以将其更改为以下代码。
// Fixing deprecated code to use current HttpClient implementations      Sekito.Lv 01/30/2019 11:29     Start
import org.apache.http.ssl.SSLContexts;
import org.apache.http.ssl.SSLContextBuilder;

//import org.apache.http.conn.ssl.SSLContexts;
//import org.apache.http.conn.ssl.SSLContextBuilder;
// Fixing deprecated code to use current HttpClient implementations      Sekito.Lv 01/30/2019 11:29     End

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接