Implementation of dependency Injection di IOC in Atitit JS

Source: Internet
Author: User

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

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.