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