Spring Framework for Delphi (Spring4D for short) is an open-source code library targeting Delphi 2010 onward. It includes mostly a Dependency Injection Framework and a Base Class Library among other modules.
Questions tagged [spring4d]
144 questions
5
votes
1 answer
What is the difference between GlobalContainer and ServiceLocator in Spring for Delphi?
They seem so similar. I can register something in the GlobalContainer:
GlobalContainer.RegisterType.Implements;
And get an instance via GlobalContainer or ServiceLocator, both of them work:
MyInstance :=…

Rafael Piccolo
- 2,328
- 1
- 18
- 29
4
votes
1 answer
Spring4D cannot sort an ordered dictionary
I need a dictionary that can be sorted. I think Spring4D TOrderedDictionary is a class implementing that but I cannot make it work: sorting doesn't work.
I build a small test program showing the issue I have:
program…

fpiette
- 11,983
- 1
- 24
- 46
4
votes
1 answer
Delphi SysUtils.Supports unexpectedly returns true
I am making a eventPublisher based on Spring4d's documentation example
The difference is that subscribers have to explicitly subscribe to events.
I want to trigger their Handle procedure based on wether or not they
implement the…

Ludovic C
- 2,855
- 20
- 40
4
votes
1 answer
Spring4d: Spring.Collections.IEnumerator and System.IEnumerator
I have a problem that should be trivial but to which I can't find any elegant answer.
I have an instance of a IList and I want to get a comma-separated string of all its distinct (case-insensitive) values.
I thought I'd just use the…

Stephane
- 3,173
- 3
- 29
- 42
4
votes
1 answer
Is the logging mechanism from Spring4D thread-safe? (units Spring.Logging.*, I suppose)
Is the logging mechanism from Spring4D thread-safe? (units Spring.Logging.*, I suppose)
For example, can several threads resolve and use an implementation for ILogger from the following container?
uses
System.SysUtils,
Spring.Container,
…

Max
- 671
- 5
- 13
4
votes
1 answer
Why should i use TCollections.CreateList and not TList.Create
i added map(), reduce() and where(qlint : string) to a Spring4D fork of mine.
While i was programming these functions, i found out that there is a differnce in the behaviour of the lists, when they are created in different ways.
If i create them…

Benedikt
- 767
- 6
- 13
4
votes
1 answer
Delphi - how to use Supports with a generic interface GUID?
(Code below)
I'm writing a Event Bus with Delphi and the Spring4d Library.
I was inspired by the samples of the Spring4d library (Event Based Architecture)
Basically, the event bus
Allows to add subscribers to it
Allows to dispatch events to…

Ludovic C
- 2,855
- 20
- 40
4
votes
1 answer
Spring4d: How to "force" the container to believe a class implements an interface
I am using RemObjects DataAbstract along with Spring4d. RemObjects generates a SchemaServer_Intf.pas file that contains interfaces for every kind of table that exists in it's schema. It allows for "Strongly typed" datasets, allowing one to access a…

Ludovic C
- 2,855
- 20
- 40
4
votes
1 answer
How to install Spring4D
I have downloaded the latest build of the Delphi Spring Framework. As directed in the readme file, I ran Build.exe and selected my two versions of Delphi (XE5 and Seattle). In neither Delphi installation can I see that a package has been installed…

Terry Thompson
- 489
- 2
- 15
4
votes
2 answers
Delphi distributed building failure
I've created a tiny project [0] to reproduce an error in a controlled environment. The facts, I'm using jenkins to build my project, a big one, I'd like to make some parallel builds. Let me make it graphically
[MyBasicPackage] ----->…

Gonzalo A.
- 123
- 7
4
votes
2 answers
Delphi: Invoke parent constructor using interface (Spring4D framework)
I am faced with the problem of properly object instantiating from the type resolved by a Spring4D framework container.
I have a class:
type
TSurvey = class ( TInterfacedObject, ISurvey )
private
_id : Integer;
_organization :…

Aptem
- 169
- 5
4
votes
1 answer
Typed interfaces and Spring4D
I am trying to use typed interfaces and Spring4D, but have some issues with Resolving. Please review details below.
DB Objects:
unit u_DB;
type
TDBObject = class
public
property ID: TGUID;
end;
TDBCRM = class(TDBObject)
public
…

SpanishBoy
- 2,105
- 6
- 28
- 51
4
votes
1 answer
How to correctly inject a property to form?
I will up the question at second time.
Do not blame me please.
Situation:
I have a form
TfrmMain = class(TForm)
private
[Inject('IniFileSettings')]
FSettings: ISettings;
public
end;
I have container initialization procedure:
procedure…

mad
- 1,029
- 3
- 17
- 38
4
votes
1 answer
How to get child interface instance from ServiceLocator in Spring4d?
I am very new in Spring4D framework and ask the help.
I have next classes and interfaces:
ICommand = interface
TCommand = class(TInterfacedObject, ICommand)
IVecadCommand = interface(ICommand)
TVecadCommand = class(TCommand,…

mad
- 1,029
- 3
- 17
- 38
4
votes
1 answer
Delphi interfaces and IList (or TObjectList)
I'm trying to implement Spring 4 Delphi and only program to interfaces instead of classes. However this seems impossible when you want to use a TObjectList.
Consider the following code:
unit Unit1;
interface
uses
Spring.Collections,
…

Rick Wheeler
- 1,142
- 10
- 22