jsr345-experts@ejb-spec.java.net

[jsr345-experts] Re: [ejb-spec users] Re: Question regarding CDI Scope for @Stateless beans

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Mon, 19 Nov 2012 14:12:44 +0000

Another option is for CDI to define that @Stateless is a JSR-330 scope, however, this feels very weird to me.

The issue here is purely one of correctness, it wouldn't change any behavior. It's just that right now Stateless EJBs are defined as "dependent" (which normally means their lifecycle depends on the bean into which they are injected), however this is not how they behave! So confusing for a user of CDI + EJB.

On 17 Nov 2012, at 01:31, Marina Vatkina wrote:

> Hmmm... so far all scopes for the EJBs are defined in the CDI spec. So it would be strange if the EJB spec define scope for one bean type...
>
> my $.02
>
> What do others think?
>
> thanks,
> -marina
>
> Mark Struberg wrote:
>> PS: please note that this does _not_ require to change any code or apply @javax.inject.Scope. This would purely be a textual clarification in the spec.
>>
>> LieGrue,
>> strub
>>
>>
>>
>> ----- Original Message -----
>>
>>> From: Mark Struberg <struberg_at_yahoo.de>
>>> To: ejb-users <users_at_ejb-spec.java.net>
>>> Cc: Sent: Friday, November 16, 2012 6:02 PM
>>> Subject: [ejb-spec users] Question regarding CDI Scope for @Stateless beans
>>>
>>> Dear EJB EG!
>>>
>>> We have a question regarding the scope which we should use for @Stateless beans handling in CDI. Currently this is defined as being treated as @Dependent. But this is obviously wrong and got only worded that way to prevent the CDI containers from applying CDI NormalScoped proxies.
>>>
>>>
>>> Please see the discussion so far on our CDI EG issue tracker:
>>> https://issues.jboss.org/browse/CDI-278
>>>
>>> A possible solution would be to define javax.ejb.Stateless as non-normalscoped CDI scope. CDI would *not* apply any client proxies itself that way but we would be able to return javax.ejb.Stateless.class in Bean#getScope() for EJBs.
>>>
>>> We think this is a good solution but don't like to define this in the CDI spec because this is clearly an EJB related question and we don't like to cross-specify EJB behaviour in the CDI spec.
>>>
>>> Wdyt? Would that fit into your concept?
>>>
>>>
>>> txs and LieGrue,
>>> strub
>>>
>>>