PicoContainer

 

PicoContainer是一个“微核心”(micro-kernel)的容器。它利用了Inversion of Control模式和Template Method模式,提供面向组件的开发、运行环境。PicoContainer是“极小”的容器,只提供了最基本的特性。

 

该项目主页:http://www.picocontainer.org/

 

What is PicoContainer?

PicoContainer is a highly embeddable, full-service, Inversion of Control (IoC) container for components honor the Dependency Injection pattern. The project started in 2003 and pioneered Constructor Injection auto-wiring. It is also Open Source and therefore free to use. The license is BSD and thus you can safely use this with commercial or other open source software.

You could use it as a lightweight alternative to Sun's J2EE patterns for web applications or general solutions.

What is Dependency Injection? Martin Fowler has a good article from 2003, but here is another view: It is a good design pattern that, for large enterprise applications, facilitates:

  • easy best practice unit testing vs little and difficult unit testing.
  • component reuse vs rewriting through ignorance or perceived needs
  • configuration given to componentsvs components reading their own scattered config
  • clean & declarative architecture vs a nest of singletons that nobody can make sense of
  • maintainability vs developers having difficulties fixing bugs
  • adaptability vs developers not knowing where to start to add features
  • transparency vs lots of framework code, with consequential lock in

Dependency Injection is quite often, but not exclusively, used by Agile practitioners. It counters situations where enterprise applications:

  • have grown to be thousands of classes, with dozens if not hundreds of Singletons
  • draw similarities to Spaghetti, Hairballs or Balls of Mud
  • has made development staff looking after it miserable, and wanting to quit
  • suffers repeated allegations of "it cannot be further developed without complete rewrite"

Despite it being very compact in size (the core is ~260K and it has no mandatory dependencies outside the JDK), PicoContainer supports different dependency injection types (Constructor, Setter, Annotated Field / Method) and offers multiple lifecycle and monitoring strategies.

If you're trying to understand the difference between PicoContainer and similar libraries, then its best to think of PicoContainer as a map that where add() is for types and implementations, and get() is for instances.

PicoContainer has originally been implemented in Java but is also available for other platforms and languages. These are detailed here.

 

 

http://www.picocontainer.org/introduction.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值