1. Instantiation: The technical beginning of the bean's life, the execution of its class constructor;
2. Properties population: Setting properties from the bean configuration and dependency injection;
3. Notification of aware interfaces:
BeanNameAware, BeanFactoryAware, and others. These interfaces are described in another post. Technically, this is carried out by system subtypes of BeanPostProcessor and coincides with step 4;4. Pre-initialization: The
postProcessBeforeInitialization() method of the BeanPostProcessor interface;5. Initialization: Various methods are applied in this order:
• Bean method annotated with
@PostConstruct from JSR-250 standard (recommended approach);•
afterPropertiesSet() method for beans implementing the InitializingBean interface;• Custom init-method, defined per-bean in the
initMethod parameter of its definition. In XML configuration, it can be set for all beans at once using default-init-method;6. Post-initialization: the
postProcessAfterInitialization() method of the BeanPostProcessor interface.