mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-21 16:19:42 +00:00
Previously, SpringApplicationShutdownHook would always register a shutdown hook, even if SpringApplication was configured not to use a shutdown hook, such as in a war deployment. This could result in a memory leak when the war was undeployed. The shutdown hook registered by SpringApplicationShutdownHook would remain registered, pinning the web application's class loader in memory. This commit updates SpringApplicationShutdownHook so that it registers a shutdown hook with the JVM lazily, upon registeration of the first application context. Fixes gh-27987