users@glassfish.java.net

JSR 250 _at_PostConstruct and _at_PreDestroy in JSR 311 (Jersey) EAR/WAR not working?

From: Alex Sherwin <alex.sherwin_at_acadiasoft.com>
Date: Sat, 4 Oct 2008 14:52:28 -0400

I'm using Jersey 1.0 ea (early access) dist of the recently finalized JSR
311 spec. Part of that spec in section 6.2 states the following:

"JAX-RS root resource classes and providers may also make use of the
following JSR 250 lifecycle management and security annotations:
@PostConstruct, @PreDestroy, @RunAs, @RolesAllowed, @PermitAll, @DenyAll and
@DeclareRoles."

However, section 6.2 begins with information speculating that support for
these JSR 250 annotations may be targeted as part of the unfinished EE 6
spec.

In testing in glassfish v2ur2 EE5 with a WAR contained inside an EAR with
the JSR 311 api/imp jars, the JSR 250 annotations are not processed
(@PostConstruct and @PreDestroy are of particular interest to me).

The JSR 311 spec states also that the Resource classes can also be EJBs,
which leads me to ask if it would be possible to somehow get the EE5
container to pick up these JSR 250 annotations.

Any ideas?


Alex Sherwin
alex.sherwin_at_acadiasoft.com