PrepZone Logo
PrepZone
Back to Spring Boot

Spring Boot · Easy

What is the role of @PostConstruct and @PreDestroy annotations?

Spring BootDI & Bean LifecycleBean LifecycleFresherSenior

Answer preview

Overview: @PostConstruct marks a method to be called after dependency injection is complete and before the bean is put into service. Used for initialization logic that requires injected dependencies to be available.…