users@jersey.java.net

Newbie question: How do I inject objects into resources

From: Ian Clarke <ian.clarke_at_gmail.com>
Date: Mon, 23 Mar 2009 18:33:50 -0500

I have an object, lets say a SQL connection, that I want my Jersey resource
classes to have access to, but I don't want to make the SQL connection
static (because some day there may be more than one of them).

How do I inject an object like this into a resource class so that it can use
it? For that matter, how do I tell resource classes about any objects
without making them available statically?

I have a feeling it may be something to do with the @Context annotation, but
I haven't been able to find clear documentation on this.

Any help would be appreciated,

Ian.