[cdi-dev] [JBoss JIRA] (CDI-278) Clarify scope of Stateless and Singleton EJB's

Stuart Douglas (JIRA) jira-events at lists.jboss.org
Thu Oct 18 17:56:01 EDT 2012

    [ https://issues.jboss.org/browse/CDI-278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727857#comment-12727857 ] 

Stuart Douglas commented on CDI-278:

But looking at the rules for Dependent scoped beans:

• No injected instance of the bean is ever shared between multiple injection points.

This is false, singletons are shared, and pooled SLSB's are kinda shared.

• Any instance of the bean injected into an object that is being created by the container is bound to the lifecycle of the newly created object.

Again, not the case 

• When a Unified EL expression in a JSF or JSP page that refers to the bean by its EL name is evaluated, at most one in- stance of the bean is instantiated. This instance exists to service just a single evaluation of the EL expression. It is re- used if the bean EL name appears multiple times in the EL expression, but is never reused when the EL expression is evaluated again, or when another EL expression is evaluated.

Not the case

• Any instance of the bean that receives a producer method, producer field, disposer method or observer method invoca- tion exists to service that invocation only.


• Any instance of the bean injected into method parameters of a disposer method or observer method exists to service the method invocation only (except for observer methods of container lifecycle events).


So basically they don't follow any of the rules for @Dependent scoped beans. 

> Clarify scope of Stateless and Singleton EJB's
> ----------------------------------------------
>                 Key: CDI-278
>                 URL: https://issues.jboss.org/browse/CDI-278
>             Project: CDI Specification Issues
>          Issue Type: Bug
>            Reporter: Stuart Douglas
> At the moment Stateless and Singleton beans are classified as @Dependent scope by default, which is not really very useful, as a lot of the rules for dependent scoped beans simple do not apply to them (they violate pretty much every rule for dependent scoped beans in 6.4).
> I think we need to define a new scope for these beans, or at least clarify their behaviour when they are @Dependent scoped. 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

More information about the cdi-dev mailing list