23.9 Application exit
Each SpringApplication
will register a shutdown hook with the JVM to ensure that the ApplicationContext
is closed gracefully on exit. All the standard Spring lifecycle callbacks (such as the DisposableBean
interface, or the @PreDestroy
annotation) can be used.
In addition, beans may implement the org.springframework.boot.ExitCodeGenerator
interface if they wish to return a specific exit code when the application ends.
java 优雅关闭相关内容
https://www.cnblogs.com/harrychinese/p/SpringBoot-graceful-shutdown.html
优雅关闭的核心目的就是:
获取到需要善后的线程池,然后提交terminate(),等待关闭