STS function details
Preface
As the saying goes: to do a good job, you must first sharpen the tool. To learn the Spring source code, you must also learn the design ideas and implementation principles of the source code, you must thoroughly learn the relationship between class inheritance and interface implementation. Therefore, let's take a look at Spring IDE-STS (Spring-Tool-Suite) in this section) currently, we will focus on how to add Spring projects to IDE management and view the class inheritance relationships, A clear and intuitive understanding of the Integration Structure of Spring source code
Download and install STS
Two Methods: Install the STS plug-in of the corresponding version of Eclipse to directly download the Eclipse-based sts ide installer here we use the Eclipse-based sts ide installer for Installation
1. Select the Eclipse-based STS to download the installation file:
After downloading and installing the SDK, start IDE:
Note: An error is reported when importing the Spring project because the Groovy plug-in of Eclipse is missing.
2. Install groovy of Eclipse
1) install groovy
Brave :~ Brave $ brew install groovy view version Brave :~ Brave $ groovy-vGroovy Version: 2.4.12 JVM: 1.8.0 _ 51 Vendor: Oracle Corporation OS: Mac OS X
2) install the eclipse-groovy plug-in
In eclipse Help-> Install New Software, download the groovy plug-in
Note: The Groovy plug-in version must be the same as the Eclipse version, otherwise it will not work.
STS version 3.9.2 Based on eclipse4.7.2, You need to download the corresponding version of groovy plug-in (4.7) version 4.7 groovy plug-in https://dist.springsource.org/release/greclipse/e4.7/related site: Spring Tool Suite: https://spring.io/tools/sts/allGroovy/Grails
Problems that may occur during project Import
1. Groovy compilation version
Solution: Modify the groovy compiler version in eclipse Configuration
Restart eclipse after conversion. Solve the problem after restart
Add Spring projects to Spring IDE Management
Open the Spring Explorer View:
Add the Spring Project to Spring IDE for Management (we will add the spring-test project to the Management)
After the project is added, the project icon will have the S icon.
The project is added to the Spring Explorer view.
Now, the project is successfully added to Spring IDE for management.
To use the IDE tool to manage SpringBean, you also need to make preparations: add the XML configuration file in the project to Spring IDE.
Add the XML configuration file in the project to Spring IDE
Right-click the project we just added in Spring Explorer and select properties
vcGVydGllcw==" src="/uploadfile/Collfiles/20180222/20180222091453705.png" />
Add XML to the Spring Explorer Project
Graphical display of Dependencies:
Display Bean dependencies in a graphical manner:
In the Bean dependency graph, we can see that the dependencies of a series of beans provide great help for our relationship and Bean design.
XML and graphical comparison
Let's reference an XML example in Spring Bean:
Graphical display of Dependencies:
Import Spring official tutorials
STS also has a powerful function: it can directly import the official Spring tutorial source code.
Browse and select the project to import:
Import Spring engineering officially provided by Spring-Pet Hospital
You can select the project and project build types, such as Maven and Gradle.
End
Here is only an import demonstration, because the Pet Hospital project does not have the gradle version, it cannot be imported. Later we will talk about the establishment of this pet hospital project, which is also a core program for us to learn about Spring source code in the future.