Java Reference
In-Depth Information
Listing 5.7. Configure default interceptors
Ordering interceptors
An interesting question that might have already crossed your mind is what would happen
if there are default-, class-, and method-level interceptors all defined at the same time (yes,
this is perfectly legal). In which order do you think the interceptors will be triggered?
Interceptors are called from the most general level to the most specific level. That is, the
default-level interceptor is triggered first, then any class-level interceptors in the order
in which they're listed in the @Interceptors annotation on the class, and finally the
method-level interceptors in the order in which they're listed in the @Interceptors an-
notation on the method. This is the default ordering of interceptors.
To change the default ordering of interceptors, you use the ejb-jar.xml file to configure the
order. The next listing shows how to override any default-level and class-level interceptors
on the OrderBean .
Search WWH ::




Custom Search