Re: JSR311: _at_Singleton

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 11 Jun 2008 09:51:22 -0400

On Jun 10, 2008, at 10:54 AM, Bill Burke wrote:
>>>>>> Can we get some support for singletons in ApplicationConfig then?
>>>>>> List<Object> getResourceInstances();
>>>>>> List<Object> getProviderInstances();
>> Another issue is that the resources and providers couldn't use
>> constructor parameters which we currently allow.
> I was asking this as an addition not a replacement for the class-
> based ones. Besides, for singletons, constructor/field/property
> injection isn't usable beyond @Context.
I can see how this would be useful as a lightweight alternative to an
IoC framework. I propose that we add a single method:

Set<Object> getSingletons();

that returns a set of singleton resources and providers. These would
take priority over any classes supplied from

Set<Class<?>> getClasses();

that is a merge of the existing getProviderClasses and
getResourceClasses methods. In both cases the implementation can work
out what instance or class does what so there's no real need to have
two methods.


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