一、github获取源码
- 访问spring-framework的github仓库地址https://github.com/spring-projects/spring-framework
- 选择你需要的版本并克隆
方法一(推荐):
git clone -b 5.1.x --single-branch --depth 10 https://github.com/spring-projects/spring-framework.git
方法二:
git clone https://github.com/spring-projects/spring-framework.git
二、安装gradle环境
- 首先保证你的Java环境是正常的(如果有问题请自行解决)
- 安装gradle
- Windows请先去gradle官网下载安装然后配置环境变量
- Mac直接用brew安装即可(这里以mac为例)
brew install gradle
3. 校验环境
gradle -version
三、把spring源码导入至idea中
接下来就是静静等待项目导入成功
导入成功后就可以看到整个工程的结构,并且选择spring-core 和 spring-oxm
执行compileTestJava
Task
接下来就是运行项目中的测试用例,以保证工程被编译
四、编写测试Module