1、環境准備
首先需要確保已經安裝和配置jdk8,maven,git環境
2、項目下載
從github獲取源碼。網址:https://github.com/spring-projects/spring-boot
我們使用的是2.1.3.RELEASE版本,點擊release 之后在tags查找相應版本或者訪問https://github.com/spring-projects/spring-boot/releases/tag/v2.1.3.RELEASE
找到 后點擊sourcecode下載源碼壓縮包
3、搭建源碼閱讀環境
導入到idea
查看spring-boot-project下的pom,會看到使用的環境的版本,因為源碼有環境約束插件,為了避免遇到錯誤,選擇對應的環境
選擇fast,還有編輯去掉test
之后在父pom中添加<disable.checks>true</disable.checks>
右側在root下點擊install
開始編譯,等待完成,時間可能比較久
編譯完成后,在spring-boot-samples-invoker下的pom中添加<skipTests>true</skipTests>
在父pom中添加<module>spring-boot-samples</module>,重新編譯,至此,環境搭建完成
運行spring-boot-samples下的demo,看是否ok