Tagged articles
SmartLifecycle
10 articles · Page 1 of 1
This article dissects Spring Boot's graceful shutdown process, explaining how SIGTERM triggers request draining, the interplay between server.shutdown modes, Lifecycle phases, thread pool behavior, SmartLifecycle ordering, and Kubernetes terminationGracePeriodSeconds, with reproducible experiments showing how misconfigured timeouts cause deployment errors.
KubernetesRequest DrainingSIGTERM
0 likes · 17 min read

This comprehensive guide dissects Spring Boot's graceful shutdown internals and health check semantics, revealing why configuring server.shutdown=graceful alone fails to prevent request loss during Kubernetes rolling updates, and provides a complete framework for coordinating shutdown phases, probe groups, and routing convergence to achieve true zero-downtime deployments.
ActuatorKubernetesProduction Readiness
0 likes · 36 min read

Explore the Spring Boot 3 lifecycle mechanisms, including the core Lifecycle and SmartLifecycle interfaces, with detailed code samples that demonstrate bean start/stop control, phase ordering, shutdown timeouts, and scheduled task management, enabling developers to fine‑tune application behavior during startup and shutdown.
LifecycleSmartLifecycleSpring Boot
0 likes · 8 min read

Implementing pre‑warming in Spring involves using several extension points—SmartLifecycle, ApplicationListener for ContextRefreshedEvent, InitializingBean, @PostConstruct, ApplicationRunner, and CommandLineRunner—each with specific execution timing and ordering considerations to ensure cache loading occurs before the web server starts handling traffic.
ApplicationRunnerCachePre-warming
0 likes · 4 min read


政采云技术Feb 16, 2023 · Backend Development
Since Spring Boot 2.3.0.RELEASE, graceful shutdown is supported for all embedded web servers (Jetty, Reactor Netty, Tomcat, Undertow) and both reactive and servlet‑based applications, using SmartLifecycle beans, configurable timeouts, and a JVM shutdown hook to allow in‑flight requests to finish while refusing new ones.
BackendEmbeddedWebServerGracefulShutdown
0 likes · 10 min read


政采云技术Feb 16, 2023 · Backend Development
Spring Boot 2.3.0.RELEASE adds graceful shutdown for all embedded web servers, explaining the underlying SmartLifecycle mechanism, configuration steps, shutdown hook registration, and how timeout handling ensures existing requests finish while new requests are rejected.
Embedded Web ServerJavaSmartLifecycle
0 likes · 11 min read

To pre‑warm business data before a Spring web service accepts requests, the article explains two approaches—implementing the SmartLifecycle interface with proper phase ordering and using a ContextRefreshedEvent listener—while highlighting code examples, execution timing, and cautions against asynchronous overrides.
BackendContextRefreshedEventJava
0 likes · 7 min read

This article explains Spring's Lifecycle and SmartLifecycle interfaces, shows how to implement custom beans that react to container start and stop events, provides complete code examples, and demonstrates the automatic startup and ordered shutdown behavior of SmartLifecycle in a Spring Boot application.
BackendJavaLifecycle
0 likes · 8 min read

The article recounts a production incident caused by an ungraceful RocketMQ consumer shutdown, analyzes the root cause involving Spring's bean destruction order and ShutdownHook behavior, and presents two solutions—using the official Spring‑Boot starter with SmartLifecycle or handling ContextClosedEvent—to achieve orderly termination.
BackendRocketMQShutdownHook
0 likes · 5 min read

In a late-night deployment, the author traced a persistent ‘DataSource already closed’ error to an ungraceful RocketMQ consumer shutdown, explored Spring’s ShutdownHook behavior, and ultimately implemented a SmartLifecycle-based solution for orderly bean destruction.
JavaRocketMQSmartLifecycle
0 likes · 7 min read
