Open GoogleCodeExporter opened 9 years ago
I've made Guice's Provider extend the JSR 330 class. This should make it easier
to interoperate with the new API.
We could also change the code where we accept a com.google.inject.Provider to
instead accept a
javax.inject.Provider, but that would break binary compatibility.
As a compromise, I'll make it so that Guice:
- always returns com.google.inject.Provider
- accepts javax.inject.Provider, wherever it does not break binary compatibility.
Original comment by limpbizkit
on 7 Sep 2009 at 7:52
From the commit log of r1077:
This checkin supports:
@javax.inject.Inject to mark classes
@javax.inject.Qualifier to identify binding annotations
javax.inject.Provider injections
A new Jsr330 utility class
Still outstanding:
JSR 330 is more strict about where its annotations are applied. These
restrictions are not yet enforced.
@Scope
@Singleton
Notable change:
When the user injects a javax.inject.Provider<T>, we canonicalize the
dependency, and treat it exactly as if they injected a
com.google.inject.Provider<T>. This is slightly weird! For example, these two
keys are equal:
Key.get(new TypeLiteral<javax.inject.Provider<String>>() {})
Key.get(new TypeLiteral<com.google.inject.Provider<String>>() {})
This is convenient, particularly for SPI users. And it means we don't need a
linked binding between the Providers. But it could be quite surprising. I'm
still trying to decide the right long term solution here...
Original comment by limpbizkit
on 7 Sep 2009 at 9:02
r1078, r1079 and r1080 complete the implementation. I've opened issue 425 to
address the @Named problem; I
believe everything else is in place.
Original comment by limpbizkit
on 8 Sep 2009 at 12:36
Why has this not officially been released ? Only 2.0 and a 3.0 snapshot are
available...tehre is no 2.1.
Original comment by miroslav...@gmail.com
on 6 Dec 2010 at 8:49
Original issue reported on code.google.com by
limpbizkit
on 7 Sep 2009 at 5:57