Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSR 330 and Guice interoperability

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?

like image 832
benstpierre Avatar asked Dec 14 '22 01:12

benstpierre


2 Answers

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

like image 149
Jesse Wilson Avatar answered Dec 24 '22 10:12

Jesse Wilson


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.

like image 24
Pascal Thivent Avatar answered Dec 24 '22 09:12

Pascal Thivent