Yes, it is initialized automatically by the Jersey framework, you can't
pass an argument to its parameter. If the injectable provider itself
cannot create the connection on its own (reading the config from
somewhere), you will have to make the connection accessible to it by
some other means.
How did you want to obtain the connection object in your resource, if
the resource would be a singleton? Can't you use the same thing in this
provider? The resource would not be instantiated by you either.
Martin
On 23.6.2011 19:20, juminoz wrote:
> Thanks Jakub and Martin.
>
> One more question. Can I assume that whatever implements
> SingletonTypeInjectableProvider is initialized automatically by the Jersey
> framework? Since I need to invoke the super's constructor with a connection
> object, I need to be able to pass it into the constructor.
>
> @Provider
> public class DSConnectionProvider extends
> SingletonTypeInjectableProvider<Context, Connection> {
> public DSConnectionProvider(Connection connection) {
> super(Connection.class, connection);
> }
> }
>
> Basically, I'm trying to figure out how this connection provider is
> initialized and also how to pass in a connection object in this case.
>
> Thanks,
> Jack
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Servlet-Init-For-Jersey-REST-Service-tp6507144p6509196.html
> Sent from the Jersey mailing list archive at Nabble.com.