JAVA面试1-Spring中Bean的生命周期

一、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   

你可能感兴趣的:(java)