users@jersey.java.net

Re: [Jersey] Resource life cycle and injections

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 10 Mar 2009 11:29:19 +0100

On Mar 10, 2009, at 11:26 AM, Erdinc Yilmazel wrote:

>> I see in the source code you are always returning an instance of
>> IoCManagedComponentProvider, if the injector contains the class. This
>> signals to Jersey that the life-cycle of the components is managed
>> by the
>> IoC container, Guice, but Jersey can inject it's own stuff onto the
>> component (hence the getScope method, so that Jersey knows what it
>> can
>> inject).
>
> OK, so what I need to return is GuiceInstantiatedComponentProvider
> instead.
>

Yes, then you can the Jersey life-cycle annotations.


>
>> Thanks. I am glad that the integration is flexible and does not
>> require much
>> code such that developers can support what they require without too
>> much
>> trouble (although i realize this area could do with more
>> documentation).
>>
>> Perhaps we need to be a bit more flexible with the Guice
>> configuration set
>> up?
>>
>> Paul.
>
> Well I am new to both jersey and guice, however imho supplying example
> source code rather then writing
> a dedicated module for guice integration may suffice, since as you
> said it may require a much more flexible setup.
>

OK.

I would really like to provide a Guice sample, but we are a bit stuck
with Guice support until we can use a maven repo with all the Guice
2.0 snapshot components. I searched but cannot find one, if anyone
else knows of one please speak up!

Paul.