Re: Singeltons

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 01 Jul 2008 13:23:56 -0400

I'm glad you brought this up because it reminded me of a change that I
missed in the 0.9 release:

I think that will address your requirement without our needing to add
a new annotation.

I don't agree with your assertion that root resource classes are
likely to be singletons, personally I find the use of ctors that per-
request allows is very handy. Also, even if we added our own
annotation for singletons that would work in the absence of an IoC
framework, we can't expect every IoC framework out there to understand
our annotation so developers will have to add IoC specific annotations
or configuration as well as our annotation. What's really needed here
is a standard for IoC and I'm hopeful we'll get there in EE 6 - for
now I don't want to add anything to the API that will complicate
integration between JAX-RS and an IoC standard.


On Jul 1, 2008, at 12:38 PM, Sergey Beryozkin wrote:

> Hi
> JAX-RS specification referes to singletons a number of time, that
> is, a singleton life cycle is given some prominent
> attention in the specification. Yet, there's no related annotation
> availbale in the API - different JAX-RS implementations use private
> techniques to mark a given root resource class as a singleton.
> My concern is that given that root resources are likely be
> singletons more often than not, it won't be possible to write even a
> basic resource implementation which will work reliably (as a
> singleton) across multiple implementations. As such I'd like to
> suggest that a common @Singleton annotation is introduced in the
> API. This way, the (singleton) resource class, injected as a
> singleton bean by a IOC framework, or instantiated by the runtime
> (in which case @Singleton will be noticed), will be a true
> singleton across multiple implementations...
> Cheers, Sergey
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Marc Hadley <marc.hadley at>
CTO Office, Sun Microsystems.