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