Dependency Injection

Remi Forax forax at univ-mlv.fr
Mon Feb 20 20:25:49 UTC 2023


----- Original Message -----
> From: "Kasper Nielsen" <kasperni at gmail.com>
> To: "Red IO" <redio.development at gmail.com>
> Cc: "amber-dev" <amber-dev at openjdk.org>
> Sent: Monday, February 20, 2023 8:57:20 PM
> Subject: Re: Dependency Injection

>> Suggestion:
>> I was wondering if this concept would be interesting to incorporate into the jdk
>> as an expansion of the ServiceLoader api.
>>
> 
> I think the practical use cases for this are going to be very limited.
> ServiceLoader always creates a new service per request. So if both B and C
> depend on A. Two instances of A will be created. Which is rarely what
> you want when you are composing an application.

It depends if you implement the static method provider or use the default constructor.

> 
> /Kasper

Rémi


More information about the amber-dev mailing list