Spring source code learning - Preparing the Environment

Together ready to read `Spring` source

Code environment ready

Download to a local source

$ git clone [email protected]:spring-projects/spring-framework.git
复制代码

Not recommended to download masterbranch code, because some small problems have been fixed, so I downloaded the v2.3.0.M2version of releasesthe code.

Because I am also while reading, while taking notes, download the source code, write the democode and comments are on the inside, little friends can download the code I uploaded, pro-test can be run ~

Cloud Gitee address code

Github Address


Set Gradle path

There are two options:

  • IDEA default selection tool (Recommend)
  • Select the user's own download Gradle (my local brew by download)

The last set:


Download dependent and compiler

After importing the project, recognizes Gradlethe dependency will first download dependencies from a central repository.

After downloading dependent, compiled code, through a graphical interface, selecting the root path buildtasks.

Finally, compiled classand other documents path in each module builddirectory.


Spring source code analysis general process

  • Introduce the concept
  • View class integrated system
  • Simple demo
  • View source
  • Process analysis

Encountered pit

Gradle project is not recognized

This problem is solved by version controllthe cloning code when opening a new project has been suggested

Could not resolve symbol "XXX"
# 还有右上角弹出的
Try resolve again
复制代码

I do not know what a start the import process error by querying the data and found that code cloneto a local post, by following these steps, the project will be able to properly identify and download the dependence:

  • Click IDEAthe File -> Openselect itemsbuild.gradle
  • Follow the prompts to set Gradle
  • Download dependent and compiler

gradle version and a version mismatch Idea

The local gradleversion is 5.4.1

$ gradle -v

Welcome to Gradle 5.4.1!
复制代码

IDEAVersion of the tool is 2018.2, check the information, there may be a higher version gradlerequires a new version IDEA, so I went to download the new version of the tool.

(By the way Amway about the new version of the theme Purple Theme Dark )

Update IDEAlater, when building the project, the last step stuck, tips:

java.lang.AbstractMethodError: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
复制代码

View information about gradlethe upgrade, there was jarthe version compatibility issues, then follow the prompts, change the compilation mode ( see picture above gradle selection method ), modification is completed, be able to build the project properly.


Reference material

1, solve the IDEA project after the import Gradle newspaper Could not resolve symbol "XXX" error

2, Gradle version of the compiler error caused the problem: Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getM

3, Gradle 5 IntelJ java.lang.AbstractMethodError

Reproduced in: https: //juejin.im/post/5d03821cf265da1bcf5dd908

Guess you like

Origin blog.csdn.net/weixin_34096182/article/details/93182675