Tagged articles
PreDestroy
12 articles · Page 1 of 1
The article explains how the forceful kill -9 command can corrupt data and break transactions in Java services, demonstrates the risks with MyISAM and distributed systems, and provides step‑by‑step guides for graceful shutdown using kill -15, ConfigurableApplicationContext.close, Spring Boot Actuator, and @PreDestroy hooks.
ActuatorJavaLinux kill
0 likes · 17 min read


Java OneDec 13, 2025 · Backend Development
This guide explains the Spring bean lifecycle, focusing on the key initialization and destruction hook methods using @PostConstruct and @PreDestroy annotations, with code examples, usage tips, and important considerations for prototype-scoped beans.
Bean LifecycleJavaPostConstruct
0 likes · 4 min read

This article explains the purpose and usage of Spring Boot’s @PostConstruct and @PreDestroy annotations for bean initialization and cleanup, discusses their migration to Jakarta EE in Spring Boot 3+, and presents modern alternatives such as @EventListener with ApplicationReadyEvent, DisposableBean, and destroyMethod configurations, complete with code examples.
Bean LifecycleJavaPostConstruct
0 likes · 8 min read

Learn how to implement graceful shutdown in Spring Boot by understanding the JVM shutdown hook, customizing cleanup logic with ContextClosedEvent listeners and @PreDestroy annotations, and configuring the spring.main.register-shutdown-hook property to ensure resources are released safely during application termination.
ContextClosedEventJavaPreDestroy
0 likes · 9 min read

This article explains Spring Boot’s bean lifecycle callbacks, covering InitializingBean and DisposableBean interfaces, @PostConstruct and @PreDestroy annotations, initMethod and destroyMethod configurations, as well as alternative approaches like SmartInitializingSingleton, ContextRefreshedEvent, and AutoCloseable, with code examples and execution order details.
DisposableBeanInitializingBeanLifecycle
0 likes · 7 min read

This article explains Spring Boot 3 bean destruction techniques—including DisposableBean, @PreDestroy, @Bean destroyMethod, AutoCloseable, and custom inference—provides complete code examples, and announces a continuously updated Spring Boot 3 case collection PDF for developers.
AutoCloseableBean LifecycleDisposableBean
0 likes · 7 min read

This article explains why using kill -9 to terminate Linux processes can cause data loss, demonstrates how to gracefully stop Spring Boot services with kill -15, the Actuator shutdown endpoint, and custom shutdown configurations, and shows how to add pre‑destroy hooks for backup tasks.
ActuatorJavaLinux
0 likes · 19 min read

This article explains the dangers of using the Linux kill -9 command on Spring Boot applications, illustrates data loss scenarios, and provides multiple graceful shutdown methods—including SIGTERM, Spring's ConfigurableApplicationContext, Actuator endpoints, and custom Tomcat shutdown configurations—complete with code examples and best‑practice tips.
ActuatorJavaLinux kill
0 likes · 21 min read

This article explains why using the violent kill -9 command can corrupt data in Java services, describes the four‑step graceful shutdown process, and provides multiple Spring Boot solutions—including SIGTERM, Actuator shutdown endpoint, custom Tomcat connector, and @PreDestroy data‑backup hooks—to stop services safely while handling thread interruptions.
ActuatorJavaLinux signals
0 likes · 20 min read

The article explains why killing a Spring Boot process with SIGKILL is unsafe and presents five practical ways—using Actuator, closing the application context, writing a PID file, invoking SpringApplication.exit, and creating a custom shutdown controller—to achieve a graceful shutdown while ensuring @PreDestroy methods run and resources are released.
ActuatorPreDestroySpring Boot
0 likes · 7 min read

Learn five practical ways to gracefully shut down a Spring Boot application—including using Actuator’s shutdown endpoint, closing the application context, PID file handling, SpringApplication.exit, and a custom shutdown controller—so unfinished tasks finish, logs flush, and services stop safely without resorting to kill‑9.
ActuatorBackendJava
0 likes · 9 min read

This article explains why graceful shutdown is important for Spring Boot services and demonstrates five practical methods—including Actuator shutdown, context closing, PID file handling, SpringApplication.exit, and a custom controller—each with complete code examples and usage instructions.
ActuatorJavaPreDestroy
0 likes · 8 min read
