Hi Paul,
I am testing the lifecycle management of a resource and added @PostConstruct
and @PreDestroy callback methods. It only works (i.e methods get called)
only if they are public. Which is not the way it works with other EE
specifications (JPA, EJB, WS...) where callback methods can have any
visibility (private is a common case because sometimes you don't want
initialization methods to be invoked).
Is that a normal or is it a bug ?
Antonio
2008/11/5 Paul Sandoz <Paul.Sandoz_at_sun.com>
> Hi,
>
> I have improved the life-cycle managed of Jersey managed stuff so that:
>
> 1) PerRequest is truly per-request meaning one instance is created per
> request (previously it was per instance).
> Thus using ResourceContext more than once for a per-request class will
> get the same instance (sub-
> resources can then get the instance of a super resource).
>
> 2) @PostConstruct and @PreDestroy are supported for resource classes and
> providers. All life-cycles,
> per-request, per-session and singleton are supported for resource
> classes.
>
>
> Note that a resource class instance created by the application and returned
> by a sub-resource locator method will not be managed by Jersey. This is
> because the life-cycle is determined by the application and is unknown to
> Jersey. To support such a case you need to either:
>
> - return the class; or
>
> - use ResourceContext to get an instance that is returned.
>
> There may be other easer ways to do this. Any ideas?
>
> Paul.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
--
--
Antonio Goncalves (antonio.goncalves_at_gmail.com)
Software architect
Paris JUG leader : www.parisjug.org
Web site : www.antoniogoncalves.org
Blog: jroller.com/agoncal
LinkedIn: www.linkedin.com/in/agoncal