HK2 is JSR-330 compliant and has useful utilities for marking classes as services and interfaces as contracts.
JSR-330 defines services and injection points that can be dynamically discovered at runtime and which allow for Inversion of Control (IoC) and dependency injection (DI).

HK2 provides an API for fine control over its operation and has the ability to automatically load services into the application.
It is the foundation for the GlassFish V3 and V4 application servers as well as other products.

HK2 also has a powerful API that can be used to perform several tasks such as binding service descriptions into the system and looking up services, as well as several extensibility features allowing the users to customize or change the behavior of HK2.

The following list gives an overview of some of the things that can be customized or extended with HK2:

  • Custom scopes
  • The use of proxies
  • Custom injection resolution
  • Assisted injection
  • Just In Time injection resolution
  • Custom validation and security
  • Run Level Services


Learn more about the HK2 API, or browse the javadoc.


Learn more about the extensibility features of HK2


HK2 is well integrated with GlassFish, Spring and others !

Back to top

Last Published: 2014-03-11.