我有声明:
MongoClient client = new MongoClient(uri);
并有警告:
[Java] Resource leak: 'client' is never closed
根据Do I need to explicitly close connection?,我不需要关闭连接。
如何抑制此警告? @SuppressWarnings(“ ???”)
最佳答案
添加@SuppressWarnings({“ resource”})应该删除有关潜在资源泄漏的警告。添加其他列表,这是针对Eclipse的,但它们应该相当相似以供参考。
What is the list of valid @SuppressWarnings warning names in Java?
关于java - 如何@SuppressWarnings:“资源泄漏:'客户端'从未关闭”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49466690/