CodePudding user response:
Dependency injection (DI) and inversion of control (IOC) is a basic meaning, because to say who is inseparable from the who, in simple terms, a relies on b, but does not control b created and destroyed, only use b, then b's control to the outside of a handle, this is called inversion of control (IOC), and a relies on b, must use the instance of b, then through a interface, the incoming b; Through the construction of a, the b incoming; By setting the attribute of a, the b incoming; This process is called dependency injection (DI), then what is the IOC Container? With the frequent use of DI, in order to realize the IOC, there will be a lot of duplicate code, even with the development of technology, more and more new implementation method and scheme, so someone put the implementation IOC code into components or framework, to avoid repeating the wheels, so realizes the IOC components or framework, we can call it the IOC Container,