users@jersey.java.net

Re: [Jersey] Simplifying Jersey life-cycle and IoC integration

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 25 Nov 2008 17:56:05 +0100

Hi Gili,

For me to accept codet requires that you have completed Sun's
Contributor Agreement [1]. IANAL but as i understand it it gives you
and Sun joint copyright of the contributed code.


On Nov 25, 2008, at 5:34 PM, Gili wrote:

>
>
> Paul Sandoz wrote:
>>
>> That looks rather good. One comment why are you using a static field
>> in GuiceServlet:
>>
>> private static Injector injector;
>>
>> that means you cannot have two or more GuiceServlet instances
>> deployed
>> in the same Web server.
>>
>> Are you satisfied that this meets most of your requirements? if so do
>> you consider it worth contributing to the Jersey code base?
>
> That's precisely what I had in mind.

Great.


> You are welcome to commit this to the
> Jersey code-base. Here is an updated version of GuiceServlet with a
> non-static injector.
>
> http://n2.nabble.com/file/n1577058/GuiceServlet.java GuiceServlet.java
>
> I will need to update this code slightly when Guice 2.0 comes out
> (it throws
> different exceptions in one place).
>

OK.

Do you have any unit tests?

What version of Guice are you using now, do you have an example pom?


> PS: The old SPI required me to implement NamedInjectable or
> something in
> order to be able to inject into method parameters. Is this still
> needed?
>

It is not required. The @Inject annotation should work to support
basic injection of Guice based classes in constructor and method
parameters. Note that it is possible to utilize the ComponentContext
to get access to any annotations and values in such cases.

Paul.

[1] https://jersey.dev.java.net/contribute/