A recent study spring source, With further study, as well as strong sigh spring, but also that learn, the more, the more it seems you do not understand, it was decided to start a blog, in order to record the process of learning.
Many people may usually also seen some spring source piecemeal work and study, but are in their own projects, spring saw a jar of class or source. Starting today, I want to project in spring seen in the source code, for debugging. . . Feel you have to take off!
A, spring build the local environment
The following are the windows 10 environment-based build system
- java version: 8+
- IDE: idea2019.2.3
- gradle:5.6.3
- Skip to download and install jdk
- gradle download and install: https://blog.csdn.net/zhaokai0130/article/details/81008719
- Download spring Source: https://github.com/spring-projects/spring-framework
Here long-winded one: It is recommended IDE idea for the latest version 2019.2.3, spring framework with a choice 5.1.x, because most people are at work to make use maven build tools, spring gradle do is to use the official build, but build tools are similar , a quick look just fine.
OK, he did not talk much, that is entered
Select the 5.1.x version, because the download speed is the problem, not directly git clone, select the download package to a local zip, download the demo source code, build environment, the whole process of compiling, testing.
-
spring5.1.x source download
-
idea to construct spring project
New project-
The following have been the next step, and finally compile a long time, it should be about 1 hour to half a day of bad luck, ha ha no way, waiting like.
-
Test demo
A spring module in a new project, a new class TestService.java test in the modified moudle
Class configuration as follows
execute the main method
We can see that in moudle which tests the newly created class added @component comment, spring after spring container vessel started our code is successfully obtained by ac.getBean (TestService.class) line of object.
So far, we have built a successful completion of the spring development environment, and verified by DEMO, we will open a new journey the following spring, and began to read the source code it!