Carsten Ziegeler wrote:

Stephen McConnell wrote:

Carsten Ziegeler wrote:

Just curious, are there any plans to support constructor and setter dependency injection in Avalon? (Or is this already
possible?)

It's already possible:


http://marc.theaimsgroup.com/?l=avalon-dev&m=107908355100216&w=2


Yes, I read this, but as far as I understood it, this covers only constructor injection of ServiceManager, Configuration etc.

Correct.


I wasn't very precise in my email, but what I meant if it's possible
to get a service via Constructor (or a setter), like

public ServiceImpl2(AnotherService o)

or

public void setAnotherService(AnotherService o).

No - this is not supported.


Using ServiceManager (or Context, etc.) maintains consistency and familiarity with A4 usage patterns which I felt to be a really high priority.

While adding support for service injection is certainly possible from a technical point-of-view - there are a lot of issues that this raises. In particular it opens up potential inconsistencies between meta-info dependency declarations and dependencies implied by a constructor signature. With standalone meta-info its is possible to do a lot of work independently of the existence or loading of a component class (without any ambiguity). This information provides us with the optional status of a service dependency, the service version, etc. In contrast a constructor signature is a poor cousin. One has to also consider the management of context entries in the same scope (also declaring optional status and semantics related to lifestyle).

My Current thinking is that injection of services (and/or context entries) introduces inconsistencies that outway the benefits. But this is the purpose of getting something out there so we can play and get a feel for the right balance.

Cheers, Stephen.

--

|------------------------------------------------|
| Magic by Merlin                                |
| Production by Avalon                           |
|                                                |
| http://avalon.apache.org/merlin                |
| http://dpml.net/merlin/distributions/latest    |
|------------------------------------------------|

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to