[cdi-dev] [JBoss JIRA] (CDI-287) Clarify the order of CDI interceptors wrt. around-invoke method of target class

Ron Šmeral (JIRA) jira-events at lists.jboss.org
Wed Oct 31 12:31:18 EDT 2012


Ron Šmeral created CDI-287:
------------------------------

             Summary: Clarify the order of CDI interceptors wrt. around-invoke method of target class
                 Key: CDI-287
                 URL: https://issues.jboss.org/browse/CDI-287
             Project: CDI Specification Issues
          Issue Type: Clarification
          Components: Interceptors
    Affects Versions: 1.0
            Reporter: Ron Šmeral


Currently, the CDI specification doesn't define, when is the around-invoke method of a target class called, with regard to CDI interceptors.

The spec. only says, in 9.4, towards the end:
bq. Interceptors declared using {{@Interceptors}} or in {{ejb-jar.xml}} are called before interceptors declared using interceptor bindings.

Currently, the order happens to be (in EAP6):
# {{@Interceptors}} and {{ejb-jar.xml}}
# Around-invoke method
# CDI interceptors

In the following example the order of interception would be:
# {{FirstInterceptor}}
# {{SomeClass.aroundInvoke}}
# {{ThirdInterceptor}}
\\
\\
{code}
public class SomeClass {
  @ThirdInterceptorBinding // bound to ThirdInterceptor
  @Interceptors(FirstInterceptor.class)
  public int doSomething() {
    // ...
  }

  @AroundInvoke // comes second
  public Object aroundInvoke(InvocationContext invocationContext) throws Exception {
    return invocationContext.proceed();
  }
}
{code}

This problem manifests in this (currently skipped) test:
https://github.com/weld/core/blob/1.1/tests-arquillian/src/test/java/org/jboss/weld/tests/interceptors/retry/RetryInterceptorTest.java

--
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