google / google/guice

RFE: Ability to delegate injection for unknown types

Open
#778 8 comments 0 reactions 0 assignees View on GitHub
imported
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

_From [cowwoc@bbs.darktech.org](https://code.google.com/u/105332154010292421344/) on October 28, 2013 06:11:49_

Use-case: Jersey 2.0 depends on HK2 (an implementation of JSR330). In order to integrate Guice into Jersey 2.0 I am building a Guice-HK2 bridge whereby HK2 delegate to Guice for unknown types and Guice delegates to HK2 for unknown types (with a mechanism to prevent endless loops).

HK2 already has a mechanism to defer injection to Guice, but Guice does not provide a mechanism to defer injection to HK2. I tried using TypeListener and asking for help on the mailing list but there doesn't seem to be a way to implement this as of Guice 3.0.

When trying to inject the following:

`@`javax.inject.Inject
public DepartmentsResource(com.google.inject.Injector injector, javax.ws.rs.core.UriInfo uriInfo)

Guice understands `@`Inject, Injector but not UriInfo. It never invokes the TypeListener for DepartmentsResource or UriInfo, so I don't have the chance to register a MembersInjector to delegate injection to HK2.

_Original issue: http://code.google.com/p/google-guice/issues/detail?id=778_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.