[cdi-dev] [JBoss JIRA] (CDI-243) Consider built-in InjectionPoint not available for stateless session beans

Mark Struberg (JIRA) jira-events at lists.jboss.org
Tue Jul 31 09:08:08 EDT 2012

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

Mark Struberg commented on CDI-243:

Agree that there is a problem, but I do not agree with the solution. 

The underlying problem is that @Stateless beans are defined as @Dependent:

See 3.2 "A stateless session bean must belong to the @Dependent pseudo-scope."

My first feeling is that this is just plain wrong. Actually a @Stateless bean is the complete opposite to @Dependent as it does _not_ share the lifecycle, but has no lifecycle at all! EJBs imo do not have any CDI standard scope at all.

A @Stateless bean could rather have a @PooledScoped or similar...

By removing the @Dependent rule from @Stateless we would automatically have the rules of 5.5.7. "Injection point metadata" applied: "If a bean that declares any scope other than @Dependent has an injection point of type InjectionPoint and qualifier @Default, the container automatically detects the problem and treats it as a definition error."

> Consider built-in InjectionPoint not available for stateless session beans
> --------------------------------------------------------------------------
>                 Key: CDI-243
>                 URL: https://issues.jboss.org/browse/CDI-243
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>            Reporter: Martin Kouba
> Right now it should be possible to inject InjectionPoint metadata to dependent SLSB (see 5.5.7. Injection point metadata). I think it may lead to inconsistencies - SLSB should not have any state as it is usually pooled and reused for every invocation.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list