Spring in Layman's

Source: Internet
Author: User

Spring is a lightweight control inversion (ICO) and aspect-oriented (AOP) framework created to address the complexities of enterprise development

IOC concept:

controlling inversion (inversion of control) is an important object-oriented programming principle to reduce the coupling problem of computer programs. He also has a name called Dependency Injection (Dependency injection), IOC is not a technology, it's a design pattern

Example Demo:

public class li{

public void introduce () {

System.out.println ("Hello, I am Lili");

}

}

public class Team {
public void firstmeeting () {
Li li = new Li ();
Li.introduce ();
}
}

The above code, it should be said that basically completed the relevant requirements, but after careful consideration will find that the above code is based on the specific scenario description, and did not abstract, so that we can not flexibly arrange the project leader to do the opening, that is, according to the current code, The opening self-introduction was tied to Xiao Li and could not be arranged for other people. To solve the above problem, we introduced the first introduction of the leader interface, the relevant code and class diagram are as follows:

Public interface Leader {public void introduce ();} Public class Li implements Leader {@Overridepublic void introduce () {System.out.println ("Hello, I am Xiao Li");} public class Team {public void firstmeeting () {Leader li = new Li (); Li.introduce ();}}

Spring in layman's

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.