我目前正在使用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');
我总是得到鲍勃,这可能还是我做错了什么?
答案 0 :(得分:0)
这已在最新版本的Spring4D
中修复