# spring-source **Repository Path**: WangWang66/spring-source ## Basic Information - **Project Name**: spring-source - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2019-05-07 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 源码中有个文件 import-into-idea.md 。按照里面的步骤操作即可: gradle cleanidea eclipse 1、源码目录中执行 ./gradlew :spring-oxm:compileTestJava。前提是需要安装 gradle。 2、导入idea Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle) 3、编译执行 ./gradlew build 编译、测试、构建、分布 To compile, test, build all jars, distribution zips, and docs 4、./gradlew -a :spring-webmvc:test 命令可以只编译spring-webmvc。 Gradle有很好的增量构建支持,所以运行时不需要执行clean命令,这样就可以保持快速运行。您还可以使用“-a”标志和“:project”前缀来避免评估和构建其他模块。例如,如果迭代Spring-webmvc中的更改,则运行以下代码只对该模块进行评估和构建 ./gradlew -a :spring-webmvc:test Gradle has good incremental build support so run without clean to keep things snappy. You can also use the "-a" flag and the ":project" prefix to avoid evaluating and building other modules. For example, if iterating over changes in spring-webmvc, run with the following to evaluate and build only that module: spring源码理解: 1、根据提供的路径,处理成配置文件数据 2、初始化上下文环境,对系统的环境变量或者系统变量进行准备和校验(模板模式) 3、初始化BeanFactory,加载XML配置信息,解析XML配置文件解析成一个个的BeanDefinition注册到BeanFactory,以key-value的形式存储在beanDefinitionMap中, 4、对BeanFactory的各种功能进行填充,在依赖注入忽略实现*Aware的接口 5、激活各种BeanFactory处理器(这里目的是注册多个BeanPostProcessor)--供spring调用统一接口进行解析 6、注册拦截Bean创建的Bean处理器,即BeanPostProcessor,如将扫描 Spring 容器中所有 Bean,当发现 Bean 中拥有@Autowired 注解时就找到和其匹配(默认按类型匹配)的 Bean,并注入到对应的地方中去,如果有事务也会给相应的bean添加jdk代理,去处理事务 7、初始化上下文广播器,在所有bean中查找listener bean,然后注册到广播器中,并开启监听器 9、去实例化非延迟加载的bean 10、清理缓存,如果容器中存Bean名为lifecycleProcessor的Bean 对其进行注册,如果不存在创建一个DefaultLifecycleProcessor进行注册