Java Reference
In-Depth Information
Finally, if more than one method‐level interceptor is present, again, the interceptors follow the order
they are listed in the @Interceptors annotation:
public class SomeBusinessService {
@Interceptors(SecurityInterceptor.class, AnotherInterceptor.class )
public void startService(){
// ...
If you need to tweak the default ordering, you can do so by custom coni guration within the EJB‐
JAR XML. The following overrides the interceptor order and provides a custom ordering:
There might be exceptional cases in which the interceptors need to be disabled. You can disable
interceptors with annotations as seen in Listing 8‐9. Java EE offers two different annotations to
disable default and class‐level interceptors separately.
LISTING 8‐9: Disabling the interceptors
package com.devchronicles.interceptor;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.enterprise.event.Event;
import javax.inject.Inject;
Search WWH ::

Custom Search