Java_PicoContainer

来源:互联网 发布:阿里云电话号码 编辑:程序博客网 时间:2024/06/06 03:37

Inversion of Control is three things: component dependencies and configuration, but also Component Lifecycle

(一)       PicoContainer's Architecture

1)       Design Patterns(设计原则)

2)       Inversion of ControlMartin fowler03

3)       Component Adapters()

ComponentAdapters are probably PicoContainer's most highly misunderstood (and coincidentally, most powerful) feature. They combine the power of an object factory, and an object interceptor rolled into one.

4个功能:

第一:Instantiation and Injectors,即如何注入并创建;

第二:Post Instantiation Modification using Behaviors;

第三:Changing the default ComponentAdapter for a new PicoContainer

第四:Changing the default ComponentAdapter when registering objects.

4)       Mock Objects(测试)

5)       Terminology(术语)

6)       Container Comparisons

Spring/EJB/Servlets/Applets

7)       Transparency

(二)       Container Choices(容器选择)

1)       DefaultPicoContainer

Parameters in its constructors can be:

Ø  Behavior Factories or Component Factories(已经实验过)

Ø  Lifecycle Strategies(已经实验过,但还是不清楚)

Ø  Component Monitors(还没有实验过)

Ø  Parent Containers of various types(已经实验过,容器结构等)

2)       CommandLinePicoContainer(从命名行接口参数的封装)

3)       PropertiesPicoContainer(从 properties file加载参数)

4)       SystemPropertiesPicoContainer(从System Properties

5)       TransientPicoContainer(暂时存在,de-referenced shortly after use

6)       TieringPicoContainer is the same as DefaultPicoContainer, except that child containers can only seek to locate unsatisfied injection dependencies for their immediate parent container. Their grandparents are out of bounds for dependency resolution.

(三)       Scoped Containers(容器关系)

PicoContainer's scope hinges on parent/child container relationships. From a PicoContainer instance you can make a child container via makeChildContainer() or addChildContainer(..).

(四)       Advanced Concepts

1.       Fluent Style

http://www.martinfowler.com/bliki/FluentInterface.html

 

(五)       Specific Behaviors特性

1.       缓存:(基本缓存,线程缓存,存储Session/Storing<HttpSession, ThreadLocal>

2.       Implementation Hiding(即不能根据具体类型获取实现,Hot Swapping)

3.       Thread Safety(同步/)

pico = new DefaultPicoContainer(new Synchronizing().wrap(new Caching()));

pico = new DefaultPicoContainer(new Locking().wrap(new Caching()));

(更有效)

4.       InterceptionAOP/侵入性还是强)

原创粉丝点击