Java Reference
In-Depth Information
SayHelloInterceptor
will be applied because the method is specifically annotated
to use it:
@Interceptors(SayHelloInterceptor.class)
@ExcludeDefaultInterceptors
@ExcludeClassInterceptors
public Order findOrderById(String id) { ... }
Now that you know how interceptors are implemented and how to specify them, we'll take
an in-depth look at the interceptor classes themselves and see them in action.
5.3.6. Interceptors in action
ing 5.10
contains the code for the interceptor. The interceptor attached to the
addBid()
method will print a log message to the console each time the method is invoked. In a real-
world application, this could be used as debugging information (and perhaps printed out
using
java.util.logging
or Log4J).
Listing 5.10. EJB business method interceptors