1
fmumu Mar 4, 2020 via Android 应该有容器销毁事件的吧,或者自己注册个 shutdownHook
|
2
Sharuru Mar 4, 2020 你要了解的可能是 Graceful Shutdown。
随便找了一篇文章可以参考一下: https://dzone.com/articles/graceful-shutdown-spring-boot-applications |
3
MoHen9 Mar 4, 2020 via Android 有,是 interface,叫什么 ApplicationEvent,匹配对应的泛型类型,好像叫这个名字,记不太清了
|
4
nutting Mar 4, 2020
有,这是 jvm 提供的
|
5
nutting Mar 4, 2020 还有 spring 本身也有容器生命周期检测,有这个注解
|
6
DeadLion Mar 4, 2020
kill -9 情况下 Graceful Shutdown 就没用了
|
7
Newyorkcity OP |
8
DeadLion Mar 4, 2020 @Newyorkcity 这个还真不清楚,kill 是 Linux 上的命令,windows server 不知道能不能生效,搜了下也没看到有用的资料。
|
9
nutting Mar 4, 2020 Runtime.getRuntime().addShutdownHook
|
10
zollum Mar 4, 2020 via Android ContextStoppedEvent 可以试下
|
11
Vkery Mar 5, 2020
Runtime.getRuntime().addShutdownHook
|