PrepZone Logo
PrepZone
Back to Spring Boot

Spring Boot · Hard

Explain the lifecycle phases of a Spring bean with example.

Spring BootDI & Bean LifecycleBean LifecycleStaffArchitect

Answer preview

Full lifecycle sequence: Instantiate → Set properties/DI → *Aware callbacks → BeanPostProcessor.before → @PostConstruct → afterPropertiesSet → custom init-method → BeanPostProcessor.after → Ready → @PreDestroy → destroy() → custom destroy-method…