users@jersey.java.net

[Jersey] Re: What happened to SingletonTypeInjectableProvider?

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Thu, 31 Jan 2013 18:06:12 +0100

Depends on how you register it, you should be able to use @Context ...

// request scope binding with specified custom annotation
bindAsContract(MyInjectablePerRequest.class).qualifiedBy(new
MyAnnotationImpl()).in(RequestScoped.class); Pavel



On 1/31/13 6:02 PM, algermissen1971 wrote:
> Hi Pavel,
>
> On 31.01.2013, at 09:51, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:
>
>> See CustomInjectablesResourceConfigTest ; https://github.com/jersey/jersey/blob/master/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/server/CustomInjectablesResourceConfigTest.java
> I see you are using @Inject there. What I am looking for is a JAX-RS only injection, to not be dependent on other frameworks. (Not sure yet, what the target environment is capable of)
>
> Or will the registered class be available using @Context, too?
>
> Jan
>
>>
>> On 1/31/13 9:47 AM, algermissen1971 wrote:
>>> On 31.01.2013, at 09:32, algermissen1971 <algermissen1971_at_mac.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am looking for a way to inject my own Singletons using @Context. In Jersey 1.x there was SingletonTypeInjectableProvider. But it seems 2.x dropped that.
>>>>
>>>> Or is that in a package that is not covered by the Jersey 2 API Docs and I need to look elsewhere?
>>> Aha - I see you now use HK2. Then ... is there maybe an example describing how to write my own context providers based on Jersey's basics?
>>>
>>> Jan
>>>
>>>> Jan
>>>
>
>