dev@jersey.java.net

Re: [Jersey] GuiceComponentProviderFactory seems to eagerly support resources that are not explicitly bound in the given Injector.

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 23 Sep 2009 16:40:52 +0200

On Sep 23, 2009, at 2:58 PM, Jae Lee wrote:

> Hi Paul,
>
> Yes, one specific use case of using multiple independent injectors
> are when you've got two independent resources with dependency to the
> common interface (in my example that will be Message), which then
> you might want each resource to depend on different implementation
> of the common interface (in my example that will be HelloWorld and
> HelloMe)
>
> I have to say the use case mentioned above is hypothetical, and I
> made it up to demonstrate the current behaviour.
>
> A more general use case of using multiple injectors that I'm really
> coming from would be when you want clear separation between group of
> resources (vertical slice of application) and thus you want to
> manage dependencies for those resources independently.
>
> With my understanding, it's OK to turn off the implicit
> instantiation, because those root level classes that Jersey
> recognises are all explicitly bound in the given Injector anyway...
> then actual instantiation will be done by Guice which then might
> instantiate some implicitly bound dependencies.
>
> It's just somewhat weird to see all Injectors other than the first
> one are ignored by ResourceComponentProvider, and totally different
> Injector is used to construct Resource that wasn't bound within.
>

OK, can you log an issue?

Thanks,
Paul.