关于java:JAVA面试1Spring中Bean的生命周期

44次阅读

共计 615 个字符,预计需要花费 2 分钟才能阅读完成。

一、Spring

 针对 Bean 的生命周期进行治理的轻量级容器

二、Bean

1、什么是 Bean
    被实例化的、组装且被 Spring 治理的对象
    In Spring, the objects that form the backbone of your application and that are managed by the Spring IoC container are called beans. A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container.
2、Bean 的生命周期
    ** 四个阶段 ** 和 ** 多个扩大点 **;扩大点又可分为 * 影响多个 Bean* 和 * 影响单个 Bean*
    2- 1 四个阶段:*  实例化 Instantiation
    *  属性赋值 Populate
    *  初始化 Initialization
    *  销毁 Destruction
    2- 2 多个扩大点
       2.2.1 影响多个 Bean
       BeanPostProcessor
       InstantiationAwareBeanPostProcessor
       2.2.2 影响单个 Bean
       Aware
         Aware Group1
            BeanNameAware
            BeanClassLoaderAware
            BeanFactoryAware
         Aware Group2
            EnvironmentAware
            EmbeddedValueResolverAware
            ApplicationContextAware   

正文完
 0