users@jersey.java.net

[Jersey] Managed sub-resources

From: John Lister <john.lister_at_kickstone.com>
Date: Sat, 07 Jan 2012 17:31:02 +0000

I may have missed the answer to this, but is it possible to have managed
sub-resources such that I can inject beans, db resource, etc into them.

For example if I have
@Path("/child/")
Child getChild(){
     return new Child();
}

then I have to either pass all the dependant resources as parameters or
make them visible to the child class so that they can be accessed from
it. The only way I can see is to make the child a bean and inject it
into the parent and return the injected object, the downside is the
extra object creation for every call.

Is there an alternative, how does everyone else do it?

Thanks






-- 
www.pricegoblin.co.uk