企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 23.9 Application退出 为确保`ApplicationContext`在退出时被平静的(gracefully)关闭,每个`SpringApplication`都会注册一个JVM的shutdown钩子,所有标准的Spring生命周期回调(比如`DisposableBean`接口或`@PreDestroy`注解)都能使用。 此外,如果想在应用结束时返回特定的退出码(exit code),这些beans可以实现`org.springframework.boot.ExitCodeGenerator`接口。