On 12/17/12 10:58 AM, Tomek Sniadach wrote:
> Hi,
> I have trouble to understand, how dependency injection in jersey
> works. Let say, i have a class "Info" that should be instantiated at
> the boot time (tomcat). Then i need the reference to the class in my
> Resource.
> What I've done:
> I have a class
> public class Info implements InjectableProvider<Resource, Type> (see
> http://jersey.576304.n2.nabble.com/Simplest-Dependency-Injection-with-Jersey-td3393338.html)
> ..
> This is registered as provider (I can see the log message at boot
> time). Then I've got an error:
> java.lang.IllegalArgumentException: Can not set ...Info field
> ...MyResource.a to org.apache.naming.NamingContext
> In MyResource I have just a Field: Info a; annotated with @Resource
>
> Can someone explain the mechanism in jersey or post a link, where i
> can find more information?
>
> regards
>
> Tomek
>
>
>
>