Skip to main content
InterviewHubPRO
Section Overview
Q3

Question 3 of 50

Part 1: Spring Core, Auto-Configuration & Architecture (1 - 10)

6%
Spring Boot & Microservices (50 Qs)•Part 1: Spring Core, Auto-Configuration & Architecture (1 - 10)

Walk through the Spring Bean Lifecycle.

senior LevelLifecycleSystem Design

In Simple Words:

  1. Instantiation: JVM creates bean instance via constructor.
  2. Populate Properties: Dependencies injected via setters/constructors.
  3. Aware Interfaces: Spring injects container references (BeanNameAware, ApplicationContextAware).
  4. BeanPostProcessor (Before Init): postProcessBeforeInitialization called.
  5. Initialization: @PostConstruct method, followed by InitializingBean.afterPropertiesSet(), followed by custom initMethod.
  6. BeanPostProcessor (After Init): postProcessAfterInitialization (AOP proxies created here).
  7. Ready for Use: Bean is live and serves traffic.
  8. Destruction: @PreDestroy method, followed by DisposableBean.destroy().