On Sep 1, 2010, at 12:36 PM, Alexandru Popescu ☀ wrote:
> On Wed, Sep 1, 2010 at 12:12 PM, Paul Sandoz
> <Paul.Sandoz_at_oracle.com> wrote:
>>
>> On Aug 31, 2010, at 11:17 PM, Alexandru Popescu ☀ wrote:
>>
>>> ... and finally it works. So final status: the jersey-guice-1.3 is
>>> now
>>> completely backported.
>>>
>>
>> Phew :-) glad it works now.
>>
>> BTW one thing i forgot to mention is that when Jersey constructs
>> and Guice
>> injects you can use the @InjectParam (on 1.4 builds, renamed from
>> @Inject in
>> 1.2/1.3) to obtain Guice bound references for constructor params.
>> This also
>> applies to any method that Jersey is responsible for invoking on a
>> resource.
>>
>> Paul.
>>
>
> I thought I'm done :-).
I think you are in terms of 1.3->1.2 transition.
> I'll need to look into this as I'm not very
> sure what you mean..
>
Using com.sun.jersey.spi.inject.Inject annotation one can defer to the
plugged in IoC framework (if one is present) to obtain a reference.
Given the obvious conflict with Guice and 330 i deprecated that in 1.4-
SNAPSHOT and renamed it to @com.sun.jersey.api.core.InjectParam.
So one could do:
public class Foo {
@Inject GuiceBaz baz;
public Foo(@InjectParam GuiceBar, @QueryParam("x") String x)
{ ... }
@GET
public String get(@InjectParam GuiceBoz boz) { ... }
}
Hth,
Paul.