[cdi-dev] [JBoss JIRA] (CDI-719) Allow attributes on scope annotations

Todor Boev (JIRA) issues at jboss.org
Mon Oct 16 05:21:00 EDT 2017


Todor Boev created CDI-719:
------------------------------

             Summary: Allow attributes on scope annotations
                 Key: CDI-719
                 URL: https://issues.jboss.org/browse/CDI-719
             Project: CDI Specification Issues
          Issue Type: Feature Request
          Components: Contexts
    Affects Versions: 2.Future
            Reporter: Todor Boev
            Priority: Minor


The 2.0 specification states that scope annotations with attributes result in non-portable behavior:
https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#defining_new_scope_type

At the same time Java EE standards like JSF use attributes on some of their scope annotations.:http://docs.oracle.com/javaee/7/api/javax/faces/flow/FlowScoped.html

There are use cases of applications that have a well defined structure, but the user must specify multiple copies of that structure. One can imagine a server application that must handle multiple endpoints, so the user must have the means to create multiple copies of a request processing pipeline. E.g. {{@RequestScoped("login")}}, {{@RequestScoped("shopping-card")}}.

Ideally CDI should use annotation instances, rather than annotation classes to select contexts. 
http://docs.jboss.org/cdi/api/2.0/javax/enterprise/inject/spi/BeanAttributes.html#getScope--
http://docs.jboss.org/cdi/api/2.0/javax/enterprise/inject/spi/BeanManager.html#getContext-java.lang.Class-
http://docs.jboss.org/cdi/api/2.0/javax/enterprise/context/spi/Context.html#getScope--

If this is not possible at least BeanAttributes can have a convenience method to get the scope annotation instance, and the specification should explicitly allow the use of attributes on scope annotations.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the cdi-dev mailing list