users@jersey.java.net

[Jersey] Re: Custom providers in Jersey 2?

From: algermissen1971 <algermissen1971_at_mac.com>
Date: Thu, 06 Jun 2013 08:33:25 +0200

On 29.05.2013, at 15:18, Marek Potociar <marek.potociar_at_oracle.com> wrote:

>
> On May 22, 2013, at 9:38 PM, algermissen1971 <algermissen1971_at_mac.com> wrote:
>
>> So you say I should do the following and JAX-RS runtime will invoke that ctor? With JSR330 ctor injection also happening?
>>
>> @javax.ws.rs.ApplicationPath("r")
>> public class ApplicationConfig extends ResourceConfig {
>>
>>
>> @Inject
>> public ApplicationConfig(MyCredentialsService s) {
>>
>> packages( ... bunch of packages with resource classes ...);
>> this.registerInstances(new SpecialAuthFeature(s));
>> }
>> }
>>
>> Yes?
>
> That may work as long as the MyCredentialsService is registered in CDI.
>

Hmm, it does not work for me - since you say *may* let me ask: Should I file a bug or am I missing something?

What do you mean by "registered in CDI"? Shouldn't CDI pick up the class without specific action?

As per http://docs.oracle.com/javaee/6/tutorial/doc/gjfzi.html

Shouldn't I rather worry about ApplicationConfig being CDI-enabled? I tried with various annotations, but without success.

Ideas?


Jan






> Marek
>
>>
>> Jan
>>
>>
>>
>>
>>>
>>> Marek
>>>
>>>>
>>>> Jan
>>>>
>>>>
>>>>
>>>> --
>>>> Paulo Pires
>>>
>>
>