JSR-330 support in Guice
The SVN version of Guice supports JSR-330 annotations ("JSR-330 Integration - This documents an experimental, unreleased feature available in Guice SVN only"). Google gives the advise: "For now, stick with Guice's annotations 开发者_StackOverflowand Provider interface." Guice 2 is a year old now and I wonder if there will be JSR-330 support in the near future. Does anyone know?
If you're comfortable using code from SVN, use that and the JSR-330 annotations. If you'd rather rely on a published release, use Guice's own annotations. Also, JSR-330 doesn't support optional injection.
Note that there's a tiny behaviour change with Guice post-2.0 to cope with the new @Inject
annotation.
- In Guice 2.0 and earlier: Methods not-annotated with
@Inject
are injected, if they override a method that does have that annotation. - After Guice 2.0: Guice not inject such methods. You need to reapply the annotation on every override.
We don't have a release date scheduled for Guice 2.1.
Apparently it is planned for 2.1 : http://code.google.com/p/google-guice/issues/detail?id=424
FYI
Guice 3.0 discussions: https://groups.google.com/group/google-guice-dev/browse_thread/thread/5a00dcc392fc8276?hl=en
精彩评论