Spring bean life cycle

1 The main operations in the life cycle

The first step, new instantiates the bean

The second step, dependency injection, is to copy the properties of the bean

The third step, the bean's setBeanName() method

The fourth step, the setBeanFactory() method of the bean

The fifth step, the setApplicationContext() method of the bean

The sixth step, the init-method attribute of the configuration file

container closed

The seventh step, the destroy() method of the bean

The eighth step, destroy-method attribute of the configuration file

2 Purpose of getting ApplicationContext in bean

First, with the ApplicationContext, you can directly get other beans.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324867938&siteId=291194637