eclipse-ee4j / eclipse-ee4j/jersey
HK2 binder registered in Feature is ignored
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Given [the major breaking change around Jersey DI](https://jersey.github.io/documentation/latest/migration.html#mig-2.26), I have spent some time today in the attempt to migrate a simple web app based on Jersey 2.25.1 to Jersey 2.26.
The web app contains a `ResourceConfig` which registers:
1. a `org.glassfish.hk2.utilities.binding.AbstractBinder`;
2. a `javax.ws.rs.core.Feature` which, in turn, registers another `org.glassfish.hk2.utilities.binding.AbstractBinder`.
Since I'm heavily relying on HK2-specific annotations, I tried to add `jersey-hk2` as a dependency of the web app but the following came out:
* the binder at _1_ is configured (i.e. its `configure` method is invoked during startup);
* the binder at _2_ is **not** configured (i.e. its `configure` method is **not** invoked during startup).
If I replace `org.glassfish.hk2.utilities.binding.AbstractBinder` with `org.glassfish.jersey.internal.inject` **in 2**, also that binder is properly configured.
I guess (and hope) that depending on `jersey-hk2` should be sufficient to consistently register HK2 binders either directly on a `ResourceConfig` and indirectly through `Feature`s.
### Test
* https://github.com/fabriziocucci/jersey-issue-3675
Contributor guide
Assessment
This issue has not been assessed yet.