Delphi Spring

          今天发现了一个delhpi的Spring框架,而且这家还是易博龙的合作伙伴。

 

          转自官方wiki。

 

         

Architecture   系统架构

The Delphi Spring Framework consists of the following libraries:

Delphi Spring 框架包含如下这些库:

  • Spring.Base

Provides the fundamental classes for the framework. Some of them are designed based on the .Net framework.

 

- Spring.Base

提供框架的基本类,其中的一部分是基于.net 框架设计。

  • Spring.Core

Provides the higher level and core features. e.g. Inversion Of Control (IoC) container.

 

-Spring.Core

提供更高层的以及核心特性,例如控制反转(IoC)容器。

  • Spring.Extensions

Includes some useful features such as Numbering.

 

-Spring.Extensions

包含一些实用功能例如数值处理。

 

 

 

Dependency Injection by the IoC container
IOC容器依赖注入

The following code demonstrates how to use the IoC container: (Register->Build->Resolve->Release)

下面的代码是使用IoC容器的示例:(注册-》构建-》解析-》释放)

// uses Spring.IoC; 
var 
  container: TContainer; 
  customer: TCustomer; 
begin 
  container := TContainer.Create; 
  try 
    container.RegisterComponent<TRealCreditCardService> 
      .Implements<ICreditCardService> 
      .AsSingleton; 
    container.RegisterComponent<TCustomer>; 
    container.Build; 
    customer := container.Resolve<TCustomer>; // Auto-wiring 
    try 
      customer.PayByCreditCard(...); 
    finally 
      container.Release(customer); 
    end; 
  finally 
    container.Free; 
  end; 
end.

 

 

 

       看到了么,是四大步骤Register->Build->Resolve->Release,注册->构建->解析->释放。   Java Spring 出到3了,加入了注解功能以及新的配置方法,只看了看2.5的 ,3 的新增还没有细看,不知是不是也能支持直接在语言代码中自动装配,看到delphi spring确实简洁,整个的注册构建和装配(解析)以及释放的过程都在代码中实现,而且很直观明晰。

 

  

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值