implementation of Dependency Injection di IOC in Atitit JS
Full class name (FQCN) is an identifier 1
Mixed Request Mode 1
You can use the in-Class builder. 2
Service Locator Method walk OK stop 2
four types of dependency injection in JavaScript technology stack 2
JS no interface, anno
However, the dynamic property is the interface default support. Ducktype can be easily injected.
Full class name (FQCN) is an identifier
to compensate for the type safety problem in the pure string request pattern, the full class name ( FQCN) The request pattern was born. The idea is that dependencies are not passed through the identifier of the string, but by the full class name of the requested dependency, when the object is requested by the container. This will prompt the "class does not exist" at compile time if the developer mistakenly writes the full class name identifier incorrectly. And, if you use IDE development tools such as Eclipse, it's easy to define the full class name identifier of the dependency into your code with the functionality of the automatic full code it provides
Mixed Request Mode
The previous section talked about The FQCN (full class name) request pattern leads to a poor softness of the dependency definition, so that the pattern of string and full-class name blending has emerged. For example, just the API in spring to declare the injection point example can be changed to use the following API:
//Spring string + API for full class name injection beanfactory Injector = new filesystemapplicationcontext (" Depositconfiguration.xml ") this .bank = (Bank) Injector.getbean ("bank", Bank. class ); //request named "Bank" and the class is Bank dependent |
  |
you can use the in-class builder.
Cls1.newbuildqb12
Service Locator Method walk OK stop
four types of dependency injection in JavaScript technology stack
author:: Nickname :Old Wow's claws( Full Name::AttilaxAkbar Al Rapanui Attilaksachanui)
Kanji Name: Etila ( Ayron) , email:[email protected]
reprint Please indicate source: http://www.cnblogs.com/attilax/
Atiend
Implementation of dependency Injection di IOC in Atitit JS