views:

518

answers:

2

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?

+7  A: 

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

Jesse Wilson
+4  A: 

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.

Pascal Thivent
This is still in SVN - is there a prognosis for when a release containing this will happen?
Thorbjørn Ravn Andersen
@Thorbjørn I don't know and I don't see much interest for JSR-330 from Guice (http://markmail.org/thread/pysiphf5t6txuh5p). This doesn't really surprise me: what Bob Lee and Rob Johnson did with this spec was pure obstruction (very close to sabotage) and I consider JSR-330 as a poor, botched, political spec. Very sad.
Pascal Thivent
Agreed. I was hoping for convergence of guice and seam to get the same independence as for servlet containers, but apparently this will not happen. I added Weld to our primary stand-alone application today, and the naive implementation added 10 seconds to the start up time.... Sigh.
Thorbjørn Ravn Andersen