Jersey Stopped Working with Injectionmanagerfactory Not Found

Jersey Client v 2

I used dependency :

        <dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.16</version>
</dependency>

and it is working fine with that :

Maybe you should change your dependency version.

Hope that helps you:)

Jersey HK2 Dependency Injection doesn't work after update to v2.27

Answer by Paul Samsotha in a comment:

Try to change your AbstractBinder import. There are two, a Jersey one and an HK2 one. Try to use the Jersey one.

Basically, I needed to change the AbstractBinder class I implemented from

org.glassfish.hk2.utilities.binding.AbstractBinder

to

org.glassfish.jersey.internal.inject.AbstractBinder

The difference is that Jersey decoupled HK2 from it's internal DI mechanism in version 2.26, and thus, I needed to use the new AbstractBinder import, which comes directly from Jersey, and not HK2.

There are a few API differences: for instance, instead of a Factory<T>, bindFactory() takes a java.util.function.Supplier<T>.

Is it possible to use Jersey without DI container?

No, it's not possible. Jersey only has an SPI for its dependency injection provider. It needs an implementation for it to run. Same way like JAX-RS is just a specification, but it needs an implementation (like Jersey or RESTEasy) to run. This is exactly the same thing. Jersey uses a lot of dependency injection internally, so the core code uses a facade for DI in its codebase. And we need to provide the underlying implementation for it to run. The implementations currently available, as you seen to understand, are HK2 and CDI (jersey-hk2 and jersey-cdi2-se). I'm sure you've seen this post



Related Topics



Leave a reply



Submit