Skip to content

Commit

Permalink
Added Interceptors with multiple bindings
Browse files Browse the repository at this point in the history
Signed-off-by: thadumi <th.theodor.th@gmail.com>
  • Loading branch information
thadumi committed Mar 22, 2020
1 parent bc5776f commit 7a54710
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
Expand Up @@ -53,3 +53,4 @@ means of enabling interceptors. For example, the CDI specification
enables an interceptor if the interceptor class is listed under the
_<interceptors>_ element of the _beans.xml_ file for the bean archive.

include::interceptors_with_multiple_bindings.adoc[]
@@ -0,0 +1,72 @@
////
*******************************************************************
* Copyright (c) 2019 Eclipse Foundation
*
* This specification document is made available under the terms
* of the Eclipse Foundation Specification License v1.0, which is
* available at https://www.eclipse.org/legal/efsl.php.
*******************************************************************
////

[[interceptors_with_multiple_bindings]]
== 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() \{ ... }



}

0 comments on commit 7a54710

Please sign in to comment.