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 10:07:55 +0100

On Nov 24, 2008, at 10:51 PM, Gili wrote:

>
>
> Paul Sandoz wrote:
>>
>> AFAICT the problem you are stating with application-based code wth
>> UriInfo is slightly different to getting the IoC integration working.
>>
>> Have you tried writing a Guice-based IoCComponentProviderFactory?
>> perhaps it would be easier to share some code and a simple maven-
>> based
>> example around this, because i am finding it hard to discuss in the
>> abstract.
>>
>
> Here is my full source-code:
>
> http://n2.nabble.com/file/n1573942/GuiceComponentProviderFactory.java
> GuiceComponentProviderFactory.java
> http://n2.nabble.com/file/n1573942/GuiceServlet.java GuiceServlet.java
>

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?

Paul.