The core of spring is control inversion, what is control inversion? A brief comment on his own humble opinion, there are improper places also hope that you point out.
Control inversion (IOC), also called Dependency Injection (DI), is actually a concept of two words.
Control reversal, what is the control being reversed? Martin Fowler concludes that " dependent object Acquisition" has been reversed .
What is a "dependent object"? in most cases, Java requires the cooperation of multiple classes to implement some kind of business logic, and each object needs a reference to the object he works with, the object that he works with is its "dependent object".
If we want to refer to other objects, we first have to instantiate the object, that is, to new an object, then there must be a coupling between the two classes of code. Although the use of methods such as Factory mode can alleviate this problem, it is not possible to fundamentally solve the problem of coupling between the code. The IOC was created to solve this problem by removing the coupling from the code and putting it into a unified XML file, which was formed by a container when needed, by injecting the required interface implementation into the class that needed it, which might be the source of the "dependency injection" argument.
So, to put it simply, control reversal is " when you need to reference an object, you give the configured XML the operation of the instantiated object that should have been controlled by you, and then inject you into it, reducing the coupling between the code ."
Play Spring MVC (i)---control inversion (Dependency injection)