NOTE
Spring Bean Lifecycle
From bean definition and instantiation through dependency injection, post-processors, initialization, proxies, use, and destruction.
This is a historical learning note and may contain outdated or incomplete understanding.
A useful high-level Spring bean lifecycle is:
- bean definition is registered/merged;
- bean instance is created;
- dependencies/properties are populated;
- awareness callbacks and
BeanPostProcessorhooks run; - initialization callbacks run;
- post-processors may return a wrapped/proxy object;
- the bean is used;
- managed destruction callbacks run when the owning context closes.
Exact hook ordering has version-specific details. The important design point is that framework post-processors can participate before/after initialization and can replace the exposed object with a proxy.