This might be a silly question, but I am puzzled by it and I could not find any clear explanation anywhere.
HK2 is a dependency injection framework implementing JS330, the foundation of Glassfish V3 and V4. As far as I can see it is used by Jersey
Weld is the reference implementation for CDI which is again a dependency injection framework and can also be used in Glassfish?
So my questions are these
I understand that the questions arise from my meagre understanding of the whole ecosystem of Java EE but any answers will be greatly appreciated
JSR330 deals with Dependency Injection. Implementations are for example Guice, HK2 and Spring. Weld does implement JSR330 but goes one step further by also implementing JSR299, specifying modules, interceptors, custom scopes, ... see this article for a short comparison.
Java EE combines several specs, not only injection but also persistence, security, web services, server faces, ... and thus requires application servers like glassfish or jboss, while (C)DI can easily used with standard web containers (jetty, tomcat) or even standalone applications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With