JSR 330 and Guice interoperability

2k views Asked by At

Does anybody have experience with JSR 330 vs Guice? From what I gather Guice is not an implementation of JSR 330 but if it is anything like Hibernate and JPA the implementation supports a bunch of additional functionality no in the API. Since I am already using GWT-Dispatch, Warp-persist guice-serlvet, etc would there be anything gained by moving to an EJB container supporting JSR 330?

2

There are 2 answers

4
Pascal Thivent On BEST ANSWER

Quoting the official announcement mail, FYI: JSR-330 support now in Guice SVN:

I've implemented support for JSR-330 to Guice. This JSR standardizes annotations like @Inject and the Provider interfaces for Java platforms. It doesn't yet specify how applications are configured, so it has no analog to Guice's modules.

This new feature may cause pain for IDE users. Since there's now two @Inject annotations, IntelliJ etc. will prompt you when it needs an import. Either one will work, but the new dialogs will be quite annoying! Even worse, the two @Named annotations aren't (yet) equivalent. So if you apply the wrong annotation, you'll get a configuration error. I'm thinking about ways to address this.

This work is ongoing. I recommend continuing to use the old com.google.inject annotations until the dust settles. http://code.google.com/p/google-guice/wiki/JSR330

This mail has been sent September 7, 2009. It's up to you to decide if the dust has settled but I'd wait a bit more and stick with the guice annotations as recommended.

0
Jesse Wilson On

Guice 2.0 does not support JSR 330, but Guice SVN includes a JSR 330-compatible injector.