jsr370-experts@jax-rs-spec.java.net

Re: CDI integration and _at_RequestScoped

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Wed, 18 Feb 2015 13:49:24 +0000

Hi Marek
On 18/02/15 13:40, Marek Potociar wrote:
> Hi Sergey,
>
> Which runtime you are referring to? CDI runtime or JAX-RS runtime?
>
I suppose it is the JAX-RS runtime, possibly with the help of a CDI
context.
A CXF colleague of mine did a CXF CDI integration and a user is
reporting @RequestScoped is not supported. I think it is because the
JAX-RS runtime is initialized with bean instances assumed to be
singletons. I guess to have CDI RequestScoped supported the JAX-RS
runtime needs to do a per-request bean initialization via the CDI
context at the invocation time.
Hence I'm curious if that is what is expected from a given JAX-RS
runtime to do...

Cheers, Sergey

> Marek
>
>> On 18 Feb 2015, at 12:27, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:
>>
>> Hi
>>
>> I've checked the spec and I'm not seeing any guidance re the scope of CDI JAX-RS root resource Beans, it only mentions that "providers or Application subclasses" have to be singleton or application-scoped.
>>
>> If a CDI root resource is annotated with @RequestScoped then does it mean the runtime is expected to ensure it is created once per every request ?
>>
>> Thanks, Sergey
>