users@jersey.java.net

Re: [Jersey] Unifying injection

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 27 May 2008 12:35:40 +0200

Paul Sandoz wrote:
> Hi,
>
> I need to make one final change to the injectable interfaces, as the use
> of extend Injectable types to define the scope is essentially
> duplicating that of ComponentProvider.Scope:
>
> public interface InjectableProvider<A extends Annotation, C> {
> ComponentProvider.Scope getScope();
>
> Injectable getInjectable(InjectableContext ic, A a, C c);
> }
>

Done.


> Only use thread local proxied injectable providers for non-per-request
> resources (performance enhancement).

Done.


> - injection meta class to perform injection to avoid use of reflection
> each time, a performance enhancement for per-request resources.

Done. Unless things are incredibly slow in other areas i reckon this may
give a noticeable performance boost.

To achieve this it is necessary to push the responsibility of injection
to the resource providers as such providers know what the life-cycle is
(see the source code in package for com.sun.jersey.impl.resource for how
this is done).


TODO:

- support injection onto fields of per-request resources for per-request
   injectable providers.

- support bean setter methods.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109