Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-719

Allow attributes on scope annotations

    XMLWordPrintable

Details

    • Feature Request
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Out of Date
    • 2.Future
    • None
    • Contexts
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rinswind Todor Boev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: