Get the App
SLTechnology News&Howtos  ›  Servers  › 

How Bean lifecycle in the context of Spring Bean applications

Shulou Source: shulou.com Published: 2022-05-31 16:35:06 10月04日 Update

This article mainly introduces "how the life cycle of Bean in the context of Spring Bean application". In daily operation, I believe many people have doubts about how the life cycle of Bean in the context of Spring Bean application. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "how to use the life cycle of Bean in the context of Spring Bean application". Next, please follow the editor to study!

Step 1, instantiation

Step 2, set the attribute value

Step 3, call the setBeanName () method of BeanNameAware

Step 4, call the setBeanFactory () method of BeanFactoryAware

Step 5, call the ApplicationContextAware method setApplicationContext () method

Step 6, call the preinitialization method of BeanPostProcessor (before >

Step 7, call the afterPropertiesSet () method of InitializingBean

Step 8, call the custom initialization method

Step 9, call the post-initialization method of BeanPostProcessor (after)

Step 10, Bean is ready to use

Step 11, close the container

Step 12, call the destory () method of DisposableBean

Step 13, call the custom destroy method

The life cycle of Bean in the Spring Bean factory:

Step 1, instantiation

Step 2, set the attribute value

Step 3, call the setBeanName () method of BeanNameAware

Step 4, call the setBeanFactory () method of BeanFactoryAware

Step 5, call the afterPropertiesSet () method of InitializingBean

Step 6, call the custom initialization method

Step 7, Bean is ready to use

Step 8, close the container

Step 9, call the destory () method of DisposableBean

Step 10, call the custom destroy method

At this point, the study on "how the life cycle of Bean in the context of Spring Bean applications" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Method cycle life up and down context application learning instance container property more help utility next factory article theory knowledge article website Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi Shulou Information MariaDB Huawei