program Demo;
{$APPTYPE CONSOLE}
uses
Classes,
Spring.Container,
Spring.Container.Resolvers;
type
IUserUpgrader = interface
['{ADC36759-6E40-417D-B6F7-5DCADF8B9C07}']
end;
TUser = class(TObject);
TUserProcessor = class(TInterfacedObject, IUserUpgrader)
public
constructor Create(AUser: TUser);
end;
constructor TUserProcessor.Create(AUser: TUser);
begin
Writeln('called constructor with passed user');
end;
begin
GlobalContainer.RegisterType<TUserProcessor>.Implements<IUserUpgrader>;
GlobalContainer.Build;
GlobalContainer.Resolve<IUserUpgrader>(
TOrderedParametersOverride.Create([TUser.Create]));
GlobalContainer.Resolve<IUserUpgrader>(
TParameterOverride.Create('AUser', TUser.Create));
Readln;
end.