Skip to content

Latest commit

 

History

History
65 lines (56 loc) · 1.34 KB

File metadata and controls

65 lines (56 loc) · 1.34 KB

Interceptors with multiple bindings

An interceptor class may specify multiple interceptor bindings.

@Monitored @Logged @Interceptor
@Priority(1100)
public class MonitoringLoggingInterceptor {
    @AroundInvoke
    public Object aroundInvoke(InvocationContext context)
        throws Exception {
        ...
    }
}

This interceptor will be bound to all methods of this component:

@Monitored @Logged
public class ShoppingCart { ... }

The MonitoringLoggingInterceptor will not be bound to methods of this component, since the Logged interceptor binding does not appear:

@Monitored
public class ShoppingCart {
    public void placeOrder() {
        ...
    }
}

However, the MonitoringLoggingInterceptor will be bound to the placeOrder method of this component:

@Monitored
public class ShoppingCart {
 @Logged
 public void placeOrder() {
     ...
 }
}