users@jax-rs-spec.java.net

[jax-rs-spec users] Re: CDI integration and _at_RequestScoped

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Wed, 18 Feb 2015 15:39:58 +0000

Hi Santiago,

On 18/02/15 14:16, Santiago Pericas-Geertsen wrote:
> Sergey,
>
> The spec clearly states that resource classes are in “per-request” scope by default in a few places. It also states that implementations can support other scopes.
>
> If a resource class is a CDI bean, then it should be created by CDI based on the whatever scope annotation it has on it.

Is CDI RequestScoped qualifies at the "other scope" as opposed to a
default per-request one where the JAXRS runtime just loads a new
instance itself ?
This is what I'm trying to understand.

If yes, does 'can support other scopes' means 'must' ?

Thanks, Sergey

>
> Not sure if that answers your question, though.
>
> — Santiago
>
>> On Feb 18, 2015, at 6:27 AM, 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
>