users@jersey.java.net

Re: [Jersey] WebApplication.addInjectable gone

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 31 Jul 2008 13:03:13 +0200

Hi Martin,

This has been replaced by:

   com.sun.jersey.spi.inject.InjectableProvider

If the annotation and type to inject are fixed and singleton you can use
the helper class:

   com.sun.jersey.spi.inject.SingletonTypeInjectableProvider

The following thread may help [1]. Also see the following blog entries [2].

For an example in Jersey runtime take a look at the code in:

   com.sun.jersey.spi.container.servlet.ServletContainer#configure

Paul.

[1]
http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users+InjectableProvider#query:list%3Anet.java.dev.jersey.users%20InjectableProvider%20order%3Adate-backward+page:1+mid:b6pqgqanugea4nlh+state:results

[2]
http://blogs.sun.com/sandoz/entry/services_are_clients_too
http://blogs.sun.com/sandoz/entry/ejb_injection

Martin Probst wrote:
> Hi,
>
> I probably missed the memo - when upgrading to Jersey-0.9-ea I found out
> that WebApplication.addInjectable is missing now.
>
> I used to use this method to register instances of - more or less -
> singleton classes that need to be injected with the web application.
>
> So my question is: if I have a single instance of a certain class, how
> to I provide this so that it can be injected into all my resource
> classes? It appears I have to use a provider in some way - is there any
> documentation on this?
>
> Thanks,
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109