>本文主要记录阅读 spring 源码过程中遇到的问题。不定时更新~
# 获取源码
GitHub地址:https://github.com/spring-projects/spring-framework
下载地址:
```
源地址:
https://github.com/spring-projects/spring-framework.git
加速源:(这个地址国内比较下载快)
https://gitclone.com/github.com/spring-projects/spring-framework.git
```
>尽量通过 **git clone** 获取源码,直接下载 ZIP 会有奇奇怪怪的问题。
# 环境要求
## A. master 分支
Gradle 版本:`5.6.4`(当前最新版本为7.4)
Java 版本:`JDK 11.0.6`
IDEA版本:当前使用 `IntelliJ IDEA 2021.3.2 (Community Edition)`
## B. 5.0.x 分支
Gradle 版本:`4.8.0`(当前最新版本为7.4)
Java 版本:`JDK 8.0.101`
IDEA版本:当前使用 `IntelliJ IDEA 2021.3.2 (Community Edition)`
# 编译遇到的问题
## 程序包jdk.jfr.Category不存在,import jdk.jfr.category
将 JDK 版本替换为 JDK 11.

同时,Gradle 的编译环境为 jdk8 时,由于 jdk8 中并没有 jdk.jfr 相关包的内容的存在,所以编译时找不到对应的类,报错。
在IDEA中设置:settings -> Build,Execution,Deployment -> Build Tools -> Gradle中,设置Gradle JVM为jdk11。如下图所示:

## Could not find method testCompile()
```
* What went wrong:
A problem occurred evaluating root project 'spring'.
> Could not find method testCompile() for arguments [org.junit.jupiter:junit-jupiter-api] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
```
gradle 版本为 7.4
在最新版本中,testCompile 改为了 testImplementation,所以找不到testCompile() 方法,只要把 testCompile 改为 testImplementation 即可


阅读spring源码过程中碰到的问题