a bean`s life
1 Spring instantiates the bean.
2 Spring injects values and bean references into the bean’s properties.
3 If the bean implements BeanNameAware, Spring passes the bean’s ID to the set-BeanName() method.
4 If the bean implements BeanFactoryAware, Spring calls the setBeanFactory() method, passing in the bean factory itself.
5 If the bean implements ApplicationContextAware, Spring will call the set-ApplicationContext() method, passing in a reference to the enclosing appli-cation context.
6 If any of the beans implement the BeanPostProcessor interface, Spring calls their postProcessBeforeInitialization() method.
7 If any beans implement the InitializingBean interface, Spring calls their after PropertiesSet() method. Similarly, if the bean was declared with an init-method, then the specified initialization method will be called.
8 If there are any beans that implement BeanPostProcessor, Spring will call their postProcessAfterInitialization() method.
9 At this point, the bean is ready to be used by the application and will remain in the application context until the application context is destroyed.
10 If any beans implement the DisposableBean interface, then Spring will call their destroy() methods. Likewise, if any bean was declared with a destroy-method, then the specified method will be called.

- 大小: 92.7 KB
分享到:
相关推荐
1.2.2. A bean’s life 1.3. Surveying the Spring landscape 1.3.1. Spring modules 1.3.2. The Spring portfolio 1.4. What’s new in Spring 1.4.1. What was new in Spring 3.1? 1.4.2. What was new in Spring ...
- **JSP Life Cycle**: The life cycle of a JSP page involves translation, compilation, and execution. During translation, the JSP page is converted into a servlet, which is then compiled and executed. ...
Beginning with an introduction to Spring and setting up the environment, the book will teach you in detail about the Bean life cycle and help you discover the power of wiring for dependency injection....
ActionForm bean represents the Model state at a session or request level, and not at a persistent level. The JSP file reads information from the ActionForm bean using JSP tags. • View The view is ...
1. **Simplification of Developer's Life**: EJB3 greatly reduces the complexity involved in developing enterprise applications by streamlining the development process and reducing the amount of ...
6. **bamboo**:竹子,常见于亚洲文化:“Bamboo is a versatile material used in many aspects of life in China.”(竹子在中国生活中有着广泛的应用。) 7. **repeat**:重复,如:“Could you please repeat ...