dev@jsr311.java.net

Re: Lifecycle options

From: Dhanji R. Prasanna <dhanji_at_gmail.com>
Date: Tue, 10 Jul 2007 20:13:33 +1000

On 7/10/07, Marc Hadley <Marc.Hadley_at_sun.com> wrote:
>
> I propose to add a @Scope annotation as follows:


To clarify my earlier post I don't think we should be inventing an IoC
profile (however limited it is) of our own. I think we'd be better served
allowing this to be an extension point where other, more rigorous, and
well-established IoC profiles can intercede (guice/spring and their ilk).

A root resource class annotated with @Scope(APPLICATION) would be
> required to a have a zero argument constructor and be thread-safe.


This is also an unreasonable restriction in my book. Constructor injection
is a vital programmer idiom and an important facilitator for
safe-publication of member fields (private final) which is a major component
to making things thread-safe.

I agree, however, that singletons ought to be designed with concurrent
access in mind and we should document that as relevant.

Dhanji.