users@jsr311.java.net

Re: Application class

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 11 Feb 2010 11:55:53 +0100

On Feb 10, 2010, at 8:46 PM, Eli Doran wrote:

> Thank you for showing me the way. :)
>
> Is the 'ManagedBean' annotation supposed to be necessary?

Yes, for portable JAX-RS applications.

Note that GAE is not EE 6 compliant so that annotation will not work.
For the annotation to work you need to deploy to an EE 6 compliant
application server.


> I used both PostConstruct and PreDestroy, without the ManagedBean
> annotation, in an Application subclass passed to Jersey servlet, on
> Jetty 7 and app engine 1.3 (local machine) and the PostConstruct
> annotated method runs fine.

Yes, that is an implementation specific feature.


> (I haven't figured out how to test that the PreDestroy is working
> for sure. When I terminate the server via console or eclipse that's
> the end of it. No more info written to log file either.)
>

PreDestroy should also work.


> Is it *odd* that those implementations honor those annotations
> without the 'ManagedBean' on the Application subclass?
>

Not really :-) if you are deploying to a non-EE-compliant platform
such a features is useful.

Paul.