Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的 web 应用程序中使用 spring-mongo。当我在 Tomcat7 中取消部署我的应用程序时,出现内存泄漏。我怀疑它可能是我没有明确关闭的 Mongo 对象。我想知道关闭它的正确方法(和位置)是什么。
像这样的东西怎么样:
@Component public class MongoDBManager { @Autowired Mongo mongo; @PreDestroy public void shutdown() { mongo.close(); } }