To read the source code, you must have a copy of the source code. This article explains how to download and install a copy of the source code. Go ahead, please

Prepare the environment before downloading the source code

The installation of source code requires the following things: JDK, IDEA, GRADLE

  • The JDK is probably one of many proposals, but it should be noted that to read Spring 5.3x, you need to install JDK11. Version issues must be addressed, or the installation will not succeed

JDK11 download address: www.oracle.com/java/techno…

  • IDEA: Versions later than 2019.2 are recommended.
  • GRADLE: Needs to be installed in advance and configured to IDEA. Installation configuration tutorial: blog.csdn.net/xlecho/arti…

Download the source code

There are two ways to download the source code

  • Configure github account encryption and use git tool fork. You can download the source code and submit it when you find defects in your project. Maybe contributing to the open source framework will give you a little bit more clout
  • Download it directly on Github using HTTP, or download the source code I have downloaded here. Address: link: pan.baidu.com/s/1MHAVErtM…

Extraction code: U9BT

Download the source code from the official website

Spring’s official website is easy to find, just baidu Spring. After entering the official website, find the framework as shown below:

Once inside, you’ll see the Github logo, which goes directly to the Spring source.

After entering, we can see the following source interface:

Downloading directly here is not recommended. Many friends will go to download the corresponding version of the source code when reading the source code, so we also have to find the corresponding version of the code, here to download 5.3.5

Click on + 205 releases and we should see the detailed version information A download link will follow

Download a copy of the source code for the version you need and start installing

Open with IDEA

Use idea directly to open the source code. Note that we need to have JDK11 and Gradle installed. After clicking open, we can see that it has many modules and it will automatically load them for us.

Note: It takes a long time to load, and can take more than an hour if you haven’t installed it and your network is bad, so be patient. Of course, you can also configure ali mirror.

Gradle configures Ali images

This configuration gives us a good acceleration, but The Spring architecture is huge and the load time is long. Configuring the image is relatively simple, and now we see an init.gradle file below the directory shown in the figure

Then put the following in the file

allprojects {
    repositories {
        maven { url 'file:///D:\\devlop\\gradle-6.8.3-alibaba\\gradle-lib'}
        mavenLocal()
        maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
        maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" }
        mavenCentral()
    }

    buildscript {
        repositories {
            maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' }
            maven { name "Bstek" ; url 'http://nexus.bsdn.org/content/groups/public/' }
            maven { name "M2" ; url 'https://plugins.gradle.org/m2/'}}}}Copy the code

After the configuration is complete, restart IDEA and load Spring again.