关于java:JAVA面试1Spring中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   

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理