# Spring源码 **Repository Path**: xulin_v2/spring_source_code ## Basic Information - **Project Name**: Spring源码 - **Description**: Spring基础,源码分析 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-05-27 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Spring源码 #### Description Spring基础,源码分析 ``` Spring默认的BeanFactory是DefaultListableBeanFactory类,spring创建DefaultListableBeanFactory对象后,会把配置信息转换成一个一个的BeanDefinition对象,并把这些BeanDefinition对象注册到DefaultListableBeanFactory对象中,以供bean工厂创建bean实例。BeanDefinition对象存储的是单个bean的配置信息,比如依赖类、scope、是否延迟加载等等。 Spring可以通过4种方式配置bean,其一是基于xml的配置,其二种是基于xml+注解的配置,其三是基于java+注解的配置,其四是基于property文件的配置。前两种的配置信息使用XmlBeanDefinitionReader对象来解析;第三种的配置信息使用AnnotatedBeanDefinitionReader对象来解析;最后一种的配置信息使用PropertiesBeanDefinitionReader对象来解析。 ``` #### 1.Spring中BeanFactory容器实现 ![](./img/BeanFactory.png) #### 2.Spring中BeanFactory与ApplicationContext ![](./img/Spring-BeanFactory-ApplicationContext.png) #### 3.BeanDefinition ![](./img/BeanDefinition.png) #### 4.XmlBeanDefinitionReader ![](./img/XmlBeanDefinitionReader.png) #### 5.AnnotatedBeanDefinitionReader ![](./img/AnnotatedBeanDefinitionReader.png) #### 6.PropertiesBeanDefinitionReader ![](./img/PropertiesBeanDefinitionReader.png) 1. xxxx 2. xxxx 3. xxxx #### Instructions 1. xxxx 2. xxxx 3. xxxx #### Contribution 1. Fork the project 2. Create Feat_xxx branch 3. Commit your code 4. Create Pull Request #### Gitee Feature 1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md 2. Gitee blog [blog.gitee.com](https://blog.gitee.com) 3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) 4. The most valuable open source project [GVP](https://gitee.com/gvp) 5. The manual of Gitee [http://git.mydoc.io/](http://git.mydoc.io/) 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)