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

Clarify what happens when an interceptor/decorator is enabled using both @Priority and beans.xml

    XMLWordPrintable

Details

    • Sprint 1

    Description

      Suppose an InterceptorA has @Priority and is also listed in the beans.xml file of a particular BDA. Such interceptor is for sure enabled because:

      An interceptor is said to be enabled if it is enabled in at least one bean archive or is listed in the final
      list of interceptors for the application, as defined in Section 11.5.2, “AfterTypeDiscovery event”.

      it matches both parts of the statement.

      As for ordering, the following statement defines invocation order:

      Interceptors enabled using @Priority are called before interceptors enabled using beans.xml.

      Since InterceptorA is enabled by both @Priority and beans.xml, the following applies:
      "Interceptors enabled using @Priority" = { InterceptorA }
      "interceptors enabled using beans.xml" = { InterceptorA }

      We can perform substitution in the statement and we get:
      { InterceptorA } are called before { InterceptorA }
      which does not seem right.

      The specification should explicitly address this scenario. There are several options (some of them are better, some are worse):
      1) Invoke the interceptor twice - each time in the corresponding order given by priority and position in beans.xml
      2) Invoke the interceptor once in the @Priority part of the invocation chain (@Priority has precedence)
      3) Invoke the interceptor once in the beans.xml part of the invocation chain (beans.xml has precedence)
      4) Forbid an interceptor to be enabled by both @Priority and beans.xml

      Attachments

        Issue Links

          Activity

            People

              meetoblivion_jira John Ament (Inactive)
              rhn-engineering-jharting Jozef Hartinger
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: