gembin

OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

HBase, Hadoop, ZooKeeper, Cassandra

Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

About Me

 

Forms of Dependency Injection

http://en.wikipedia.org/wiki/Dependency_injection

Martin Fowler identifies three ways in which an object can get a reference to an external module, according to the pattern used to provide the dependency:

依照提供依赖项时使用的模式,Martin Fowler定义了三种对象可以从得到一个外部模块引用的方式:

  • Type 1 or interface injection, in which the exported module provides an interface that its users must implement in order to get the dependencies at runtime (as introduced by Borland Delphi and followed up by C++Builder and JBuilder[citation needed]).
  • Type 2 or setter injection, in which the dependent module exposes a setter method which the framework uses to inject the dependency.
  • Type 3 or constructor injection, in which the dependencies are provided through the class constructor. This is the main form used by PicoContainer, although it also supports setter injection.
  • 类型1 接口注入,外部模块提供一个接口,使用者必须实现此接口以在运行期得到依赖项(Borland Delphi引入,并在C++ BuilderJBuilder中继续运用)。
  • 类型2 设置器注入,使用者暴露一个设置器方法,框架将使用此方法注入依赖项。
  • 类型3 构造器注入,依赖项通过类构造函数提供。这是PicoContainer使用的主要方式(尽管它同时也支持设置器注入)。

 

The open source Yan Container[1] provides support for arbitrary types of injection[2] besides the common ones defined above.

除了前列的几种普通形式外,开源项目Yan Container还对任意形式的注入提供了支持。

 

Existing frameworks

现有框架

 

Dependency injection frameworks exist for a number of platforms and languages including:

在一些平台和语言中都有依赖注入框架,包括:

ActionScript

C++

ColdFusion

Delphi

Java

Java 2 Micro Edition

.NET

PHP4

PHP5

Perl

Python

Ruby

See also

参见

 

External links

外部链接

Retrieved from "http://en.wikipedia.org/wiki/Dependency_injection"

Categories: Software components | Software architecture

Hidden categories: Articles to be merged since June 2008 | Articles lacking in-text citations | All articles with unsourced statements | Articles with unsourced statements since July 2008

posted on 2008-11-06 13:42 gembin 阅读(594) 评论(1)  编辑  收藏 所属分类: IoC

评论

# re: Forms of Dependency Injection 2009-04-26 16:37 6yuyiy

wow gold:<a href=http://www.wowgoldbank.com/wow-gold/>wow gold</a>,wow gold website:<a href=http://www.wowgoldz.com>wow gold</a> tks  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿(6)

随笔分类(440)

随笔档案(378)

文章档案(6)

新闻档案(1)

相册

收藏夹(9)

Adobe

Android

AS3

Blog-Links

Build

Design Pattern

Eclipse

Favorite Links

Flickr

Game Dev

HBase

Identity Management

IT resources

JEE

Language

OpenID

OSGi

SOA

Version Control

最新随笔

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜

free counters