`
javamore
  • 浏览: 63433 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

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

分享到:
评论

相关推荐

    PicoContainer源码学习日志

    《PicoContainer源码学习日志》 PicoContainer是一个轻量级的依赖注入框架,主要应用于Java项目中。它的核心理念是通过组件容器来管理对象的生命周期和依赖关系,从而实现松耦合的设计。本学习日志将深入探讨...

    Android代码-picocontainer

    PicoContainer 3.x is in Git at Github and Codehaus (mirrors), and is a work in progress. PicoContainer 3.x is good enough to use in production, but it is not finished yet. Goals over 2.x The major ...

    picocontainer:Java微容器

    **Picocontainer:Java微容器详解** Picocontainer是一个轻量级的依赖注入框架,它在Java世界中扮演着重要角色,特别是在简化应用程序组件的组装和管理方面。这个框架以其小巧、快速和易于理解的特点而受到开发者的...

    cucumber-picocontainer-example

    CucumberPicoContainer示例开发环境安装Git( ) 安装JDK 1.5+( 或 ) 安装Maven 3( )下载git clone git@github....jar target/cucumber-picocontainer-example-jar-with-dependencies.jar

    cake-picocontainer-1.3.jar

    jar包,亲测可用

    cake-picocontainer-1.3-sources.jar

    jar包,亲测可用

    coconut-internal-picocontainer-1.3.jar

    jar包,官方版本,自测可用

    vertx-pico-support:vert.x 的 PicoContainer 支持

    PicoContainer 支持 vert.x 使用依赖注入。 用法 创建一个垂直: public class MyVerticle extends Verticle { public void start() { ApplicationContext applicationContext = ApplicationContext.create() ....

    Java轻量级容器的比较.pdf

    Java轻量级容器,如Spring、HiveMind和PicoContainer,是为了降低系统组件间的耦合度而设计的。它们都采用了依赖注入这一核心设计模式,但在实现方式和哲学上各有不同。 **Spring Framework** 是一个功能全面的轻量...

    Ioc模式和微容器——j道

    在这个例子中,`B`类的实例是由PicoContainer创建的,同时它也会自动处理`B`类所需的`AInterface`实例。 ##### Spring Framework Spring 是一个广泛使用的Java企业级应用开发框架,它提供了强大的依赖注入功能。 ...

    jbehave-pico-3.9-beta-4.zip

    JBehave 集成了多种依赖注入框架,其中 PicoContainer 是一个轻量级的容器,用于管理对象的生命周期和依赖关系。3.9-beta-4 版本可能包含了对框架的改进和修复,以提供更稳定、高效的测试支持。 【描述】中的 "mod-...

    JdonFramework开源框架 v5.1 Build20071025_jdonframework(毕设 + 课设).zip

    3. **PicoContainer集成**:JdonPicoContainer是Jdon内置的轻量级容器,负责对象的生命周期管理和依赖注入。PicoContainer的轻量级特性使得框架运行更高效,同时保持了足够的灵活性。 4. **持久层支持**:虽然提供...

    IoC 容器和Dependency Injection 模式

    - **PicoContainer**:PicoContainer 是一个轻量级的 IoC 容器,它的设计目标是简单易用。虽然没有 Spring 那么全面,但对于小型项目或简单的依赖管理来说已经足够。 #### 六、总结 IoC 容器和依赖注入模式是现代...

    JacORB安装包

    %JACORB_HOME%\lib\picocontainer-1.2.jar;%JACORB_HOME%\lib\slf4j-api-1.5.6.jar; %JACORB_HOME%\lib\slf4j-jdk14-1.5.6.jar;%JACORB_HOME%\lib\wrapper-3.1.0.jar; 修改PATH添加%JACORB_HOME%\bin

    svnant-1.3.1相关整合的jar包

    5. `picocontainer-x.x.x.jar`: PicoContainer,依赖注入容器,用于管理和实例化SVNANT的任务对象。 6. `slf4j-api-x.x.x.jar` 和 `slf4j-simple-x.x.x.jar`: Simple Logging Facade for Java (SLF4J),日志框架抽象...

    [依赖注入] 依赖注入 实战 (英文版)

    This book is written for developers and architects who want to understand Dependency Injection and successfully leverage popular DI technologies such as Spring, Google Guice, PicoContainer, and many ...

    struts2-lib

    PicoContainer作为依赖注入容器,`picocontainer.jar`;以及Apache Commons的各种组件,如`commons-lang3.jar`、`commons-fileupload.jar`等。 6. **Servlet容器兼容**:由于Struts2基于Servlet API,所以会包含与...

    Martin Fowler 控制反转与依赖注入

    例如,使用PicoContainer进行构造函数注入时,可以轻松地将依赖项作为构造函数参数传递给对象,PicoContainer会负责创建这些依赖项并将其注入到目标对象中。 - **设值方法注入**:另一种常用的依赖注入方式,依赖...

    DI容器框架Google Guice与Spring框架的区别

    这里提到了更多的DI容器,如Spring、PicoContainer和EJB容器,但主要关注的是Guice与Spring的对比。这暗示我们将深入比较Guice和Spring在实现DI时的具体特点,以及它们与其他DI容器相比的独特之处。 **详细知识点:...

Global site tag (gtag.js) - Google Analytics