Spring Source Code learning: Step 1 -- add the simplest Demo code in Spring source code, springdemo
To stay close to and learn Spring source code to the maximum extent, you can directly add the Demo code to the Spring source code and debug it.
Based on previous experiences in using Spring, the simplest way to use Spring is: An entity class, an Xml configuration file, and a test method. For use without the source code, at least the spring-context dependency must be introduced. So I guess, can I directly add the simplest code in the Spring-context module in the spring source code?
Create an object class (Person, located at com. cyh package), Xml configuration file (person. xml), a simple test method (PersonTest), the structure is as follows:
As for the content, it is simpler:
Everything is normal, and the console successfully prints the following content:
Person. getClass (). getName (): com. cyh. Person
The simplest Demo code is added to the Spring source code and runs successfully ~
Provide their own from GitHub Fork and "trample" Spring Source Code address: https://github.com/cyhbyw/spring-framework/tree/Branch_v4.2.5.RELEASE