spring有关闭进程来放置清理代码吗?

2023-12-19

当我的 Spring Web 应用程序关闭时,是否有一个事件我可以以某种方式连接到我可以执行一些清理代码以清空一些池等。


您可以使用以下内容

  1. destroy-method as @amir75 recommends

  2. @预销毁 http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-postconstruct-and-predestroy-annotations注解

  3. 实施一次性豆 http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/DisposableBean.html并重写销毁方法。

有关这些的所有详细信息可以在以下位置找到一次性回调 http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-factory-lifecycle-disposablebean.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

spring有关闭进程来放置清理代码吗? 的相关文章

随机推荐