Spring Source Code learning: Step 1 -- add the simplest Demo code in Spring source code, springdemo

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.