Is it possible to register the same class / interface multiple times in Spring4D?

375 Views Asked by At

I'm currently playing around with the Spring4D framework and think it's pretty cool. I'm trying to achieve the following

  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
  );

With TPerson/IPerson having the obvious definitions. But regardless if I try

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

or

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

I always get Bob, is this possible or am I doing something wrong?

1

There are 1 best solutions below

0
On

This is fixed in the latest version of Spring4D