Skip to main content
Create Account Login Help

Main Menu

  • Home
  • Projects
  • Forums
  • People
  • Java User Groups
  • JCP

Introduction

HK2 is an implementation of the JSR-330 standard. It also provides an API for fine control over the operation of HK2 and the ability to automatically load services into the service registry. It is the foundation for the GlassFish V3 application server and consist of several technologies.

JSR-330 implementation

HK2 is an implementation of the JSR-330 standard. It adds in some 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.

To see how to use HK2 as a JSR-330 implementation see this page.

HK2 API

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.

For more information on how to use the HK2 API see this page.

You can also see the Javadoc for the HK2 API here.

HK2 Extensibility

HK2 has several extensibility features. These are features which allow 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
  • Custom injection resolution
  • Assisted injection
  • Just In Time injection resolution
  • Custom validation and security

For more information on HK2 extensibilty see this page.

Configuration

Most software need to store some configuration for persisting behaviours accross restarts. Such configuration is usually stored in xml files and can be consumed like any other services in hk2. We provide a powerful abstraction to a configuration file definition, coupled with a 2 phase transactional system to mutate any configuration that ensure isolation and completness of any configuation changes.

Link to Configuration

Testing

An integration with JUnit is provided so users can develop their tests with dependency injection available. For more sophisticated tests, a harness is also provided to start modules and habitat during test execution

Link to Testing


 
 
spacer
spacer
Please Confirm
spacer
 
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.