Affects Version/s: None
Fix Version/s: None
GlassFish modules should move away from using non standard Classes like Habitat and use standards based annotations and classes as specified by jsr 330(javax.inject.Inject, javax.inject.Provider etc.). To quote Jerome: "Classes like Habitat exposes too many APIs available to the users that makes the hk2 evolution very difficult. " Also some of the APIs are unclear (when to use habitat.getComponent() versus habitat.getByType() /habitat.getByContract() ).
So, the first step is to move away from Habitat (where ever possible) and use jsr 330 interface and annotations.
In order to do this, the hk2 team will be making the following changes to the GlassFish modules.
1. Move away from org.jvnet.hk2.annotations.Inject to javax.inject.Inject
1.1 We will convert
1.2 We will convert
1.3 We will convert
1.4 We will convert
2. If we find that a class injects Habitat (or Services) and uses
then we will do the following:
2.1 Introduce a new injection:
2.2 replace the getBycontract() / forContract() calls with:
3. If we find that a class...
a) implements PostConstruct,
b) injects Habitat (or Services) and
c) uses habitat.getByContract(Foo.class) or services.forContract(Foo.class).get() in the postConstruct method,
...then we will do the following:
3.1 replace the getBycontract() / forConttract() calls with:
3.2 Obviously, we will talk to the module owner to find out why the injection was not made in the first place.