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