我目前正在尝试使用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');我总是得到Bob,这是可能的还是我做错了什么?
发布于 2015-08-09 03:20:55
在最新版本的Spring4D中已修复此问题
https://stackoverflow.com/questions/18325788
复制相似问题