-
Clarification
-
Resolution: Done
-
Major
-
1.0
-
None
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:
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
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(); } }
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
- blocks
-
CDITCK-287 Test interceptor ordering if around-invoke or lifecycle event callback methods declared on the target class
- Resolved
- relates to
-
AS7-6015 Session bean target class around-invoke method called before CDI interceptors
- Resolved