Java Reference
In-Depth Information
StudentSessionBeanWithoutInterceptor {
private Logger logger = Logger.getLogger(
@Schedule(minute="*/2", hour="*")
public void executeEvery2Second(){"executeEvery2Second -
executeEvery5Second - date : "+new Date());
public Student createEntity(Student std){"createEntity-Name of the
student : "+std.getFirstname());
return std;
Latest improvements in action
For all the new features added to the Interceptors 1.2 Specification, the most import-
ant are certainly: adding of a lifecycle callback interceptor for constructors, adding of
standard annotation for managing the execution order of interceptors, and finally, the
transfer of interceptor binding from the CDI Specification to Interceptors Specifica-
tion 1.2.
Intercept constructor invocation
Due to the @AroundConstruct annotation, you can define an interceptor that will
run just before the creation of the target instance to intercept the execution of the tar-
get instance constructor. Interceptor methods decorated with this annotation should
not be defined in the target class.
The following code demonstrates how to use the @AroundConstruct . The ex-
ample is to record the time at which the different methods have been called to be
sure that the method @AroundConstruct is indeed run before the constructor. It
also shows you how to access the name of the constructor and its parameters.
Search WWH ::

Custom Search