I\'m now using Jersey and I want to Inject a GeneralForm map into the Resource class context, which accepts all application/json, multipart/f
Jersey 2.26 made some changes to its DI support. First it removed HK2 as a hard dependency and added an abstraction layer. The new framework uses some of the names from HK2 but the packaging is different. For instance the AbstractBinder. You can see in your code, that there is no hk2 in the package name. This is the new abstraction layer Jersey uses.
The new layer makes a lot of use of Java 8. For instance with the bindFactory, it no longer uses the HK2 Factory, but instead uses the Java 8 Supplier. For for bindFactory you would now make your factory implement Supplier
public class GeneralFormFactory implements Supplier {
private final HttpServletRequest request;
@Inject
public GeneralFormFactory(HttpServletRequest request) {
this.request = request;
}
@Override
public GeneralForm get() {
GeneralForm result = new GeneralForm();
return result;
}
}