users@jersey.java.net

[Jersey] Proposal: DI abstraction

From: cowwoc <cowwoc_at_bbs.darktech.org>
Date: Fri, 08 Nov 2013 11:20:14 -0500

Hi,

I propose going through the Jersey source-code iteratively, replacing
all instances where it interacts with HK2 directly (e.g. by referencing
ServiceLocator) and replacing it with some interface. I would then
provide reference implementations for HK2, Spring, Guice that implement
that interface. I believe we'll need to do the following:

  * Provide an interface just for injection. I believe JSR-330 already
    covers this, but if we need anything more we'll provide our own
    interface.
  * Instead of pushing bindings from Jersey into HK2, provide building
    blocks (POJO classes) for constructing built-in types (e.g.
    UriInfo). Then provide HK2, Guice, Spring specific code that would
    configure each specific DI to inject using these blocks.

To begin this discussion, I'd like to take one built-in type (is UriInfo
a good start?) and look at what is needed to construct it without DI.
Marek, can you provide some details on this end?

Thanks,
Gili