From the course: Java EE 8 Essential Training

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Interceptor methods

Interceptor methods

- CDI provides support for interceptors that allow developers to implement cross-cutting concerns in their applications, such as logging, auditing, and security. Interceptors are triggered when methods on a particular bean are invoked, allowing the cross-cutting logic to be introduced. The first step for setting up an interceptor is to create an interceptor binding type, which is an annotation that is used to associate an interceptor with a bean or a bean method. We can just open up the new dialogue. Within the new dialogue, we can type interceptor, and we'll see the interceptor binding annotation. We want to select that. Then we're going to go ahead and specify the package as com.LinkedIn.jsf. Here, we can create a name for our interceptor binding. We're going to call this the logging interceptor binding. We'll just provide a name of logging. You'll notice that it's able to target different sections of a…

Contents