Java Reference
In-Depth Information
TABLE 23-1. Interceptor Metadata Annotations
Interceptor Classes
Interceptor classes may be designated with the optional
javax.interceptor.Interceptor annotation, but interceptor classes aren't re-
quired to be so annotated. An interceptor class must have a public, no-argument construct-
or.
The target class can have any number of interceptor classes associated with it. The order
in which the interceptor classes are invoked is determined by the order in which the inter-
ceptor classes are defined in the javax.interceptor.Interceptors annotation.
However, this order can be overridden in the deployment descriptor.
Interceptor classes may be targets of dependency injection. Dependency injection occurs
when the interceptor class instance is created, using the naming context of the associated
target class, and before any @PostConstruct callbacks are invoked.
Interceptor Lifecycle
Interceptor classes have the same lifecycle as their associated target class. When a target
class instance is created, an interceptor class instance is also created for each declared in-
terceptor class in the target class. That is, if the target class declares multiple interceptor
classes, an instance of each class is created when the target class instance is created. The
target class instance and all interceptor class instances are fully instantiated before any
@PostConstruct callbacks are invoked, and any @PreDestroy callbacks are in-
voked before the target class and interceptor class instances are destroyed.
Search WWH ::




Custom Search