是否可以在Spring4D中多次注册相同的类/接口?

时间:2013-08-20 01:52:18

标签: delphi spring4d

我目前正在使用Spring4D框架并认为它非常酷。我正在努力实现以下目标

  GlobalContainer.RegisterComponent<TPerson>.Implements<IPerson>('Normal');
  GlobalContainer.RegisterComponent<TPerson>.Implements<IPerson>('TestData').DelegateTo(
    function: TPerson
    begin
      result := TPerson.Create;
      result.SetFirstName('Bob');
      result.SetSurname('Smith');
    end
  );

TPerson / IPerson有明显的定义。但不管我是否尝试

  Person := ServiceLocator.GetService<IPerson>('Normal');

  Person := ServiceLocator.GetService<IPerson>('TestData');

我总是得到鲍勃,这可能还是我做错了什么?

1 个答案:

答案 0 :(得分:0)

这已在最新版本的Spring4D

中修复
相关问题