Re: GWT dev mode and GIN and dependency injection in general

201 views
Skip to first unread message

Jens

unread,
Feb 28, 2013, 1:35:56 PM2/28/13
to google-we...@googlegroups.com

I just experimented somewhat with Gin and realized that it (v2.0) seems to break the incremental compilation feature of GWT's development mode, ie. where I just have to save the .java source file and the gwt dev mode server automatically incorporates the changes.

Not exactly sure what you mean with incremental compilation but when I reload my app everything works like expected and file changes are picked up by DevMode (Gin changes are also picked up on the fly). Just realized that I have never tried to change a file and see if changes are picked up by DevMode when I just navigate back and forth in the app so the modified classes need to be re-instantiated.


 

Can someone confirm this or is it my own fault?

In general: what DI frameworks are there for GWT? I'd like to have something akin to Spring's auto-wiring based on interfaces+class path scanning, but, of course, *before* runtime, ie. at compile time to avoid performance loss in production.


For GWT client code your DI options are pretty much

- google-gin (based on google-guice)
- sheath (based on Dagger from Square). But sheath is only a proof of concept. Not sure how well it currently works.
- I think Errai from JBoss also provides DI functionalities.



-- J.

alucard

unread,
Feb 28, 2013, 5:21:48 PM2/28/13
to google-we...@googlegroups.com


On Thursday, February 28, 2013 6:43:11 PM UTC+1, Marc wrote:
Hello!


I just experimented somewhat with Gin and realized that it (v2.0) seems to break the incremental compilation feature of GWT's development mode, ie. where I just have to save the .java source file and the gwt dev mode server automatically incorporates the changes.

Can someone confirm this or is it my own fault?
 
I believe you're right. If you "mess" with DI stuff (for example add a new parameter to a constructor annotated with @Inject) the code will break when you reload. You have to rebuild the project at that point. I believe this is due to gin using generators which are not triggered on reload.  

In general: what DI frameworks are there for GWT? I'd like to have something akin to Spring's auto-wiring based on interfaces+class path scanning, but, of course, *before* runtime, ie. at compile time to avoid performance loss in production. I'm even thinking about an annotation processor that generates the GinModule bindery code, however, using something that already exists and is properly maintained is always an advantage ;-).

I believe gin is the best DI for GWT out there. 


Best regards,
Mark

Thomas Broyer

unread,
Feb 28, 2013, 5:43:57 PM2/28/13
to google-we...@googlegroups.com


On Thursday, February 28, 2013 11:21:48 PM UTC+1, alucard wrote:


On Thursday, February 28, 2013 6:43:11 PM UTC+1, Marc wrote:
Hello!

I just experimented somewhat with Gin and realized that it (v2.0) seems to break the incremental compilation feature of GWT's development mode, ie. where I just have to save the .java source file and the gwt dev mode server automatically incorporates the changes.

Can someone confirm this or is it my own fault?
 
I believe you're right. If you "mess" with DI stuff (for example add a new parameter to a constructor annotated with @Inject) the code will break when you reload. You have to rebuild the project at that point. I believe this is due to gin using generators which are not triggered on reload.  

While this was true in previous versions, I believe it no longer is starting with GIN 2.0.

Jens

unread,
Feb 28, 2013, 5:48:08 PM2/28/13
to google-we...@googlegroups.com

 
I believe you're right. If you "mess" with DI stuff (for example add a new parameter to a constructor annotated with @Inject) the code will break when you reload. You have to rebuild the project at that point. I believe this is due to gin using generators which are not triggered on reload. 

You should update your GIN version ;-) With GIN 2.0 you can simply reload the page and nothing will break when you have changed dependencies in constructors, etc. or you have changed bindings in your GinModule.

-- J.

alucard

unread,
Mar 1, 2013, 4:57:09 AM3/1/13
to google-we...@googlegroups.com
You know you re both right. Funny thing is I had GIN 2.0 in my project a long time but since I had not realised that gin was improved God knows how many times I needlessly rebuilt my project. *facepalm*
Reply all
Reply to author
Forward
0 new messages