Just in case you haven’t seen it yet: there is very interesting talk from Ray Ryan available online:
A common question people ask is how to architect a GWT app. Ray Ryan discusses real-world learnings and patterns from the Google AdWords team and elsewhere which you can use in your apps.
While dependency injection on the client side in general is nothing new, having it on a GWT application (I mean on the client) is something a little harder to setup. Since we don’t have reflection and dynamic proxies… But GWT provides an alternative called deferred binding, and there is a project called Gin providing the Guice DI approach for GWT apps.
There are some other projects like gwt-dispatch and gwt-presenter that where created inspired by Ray Ryans talk.
So if you are doing or planning GWT development, have a look at the video and the following projects:
- gwt-dispatch: Inspired by Ray Ryan’s Best Practices For Architecting Your GWT App session at Google I/O 2009, this is an implementation of the ‘command pattern’ discussed at the beginning of the video.
- gwt-presenter: Inspired by Ray Ryan’s Best Practices For Architecting Your GWT App session at Google I/O 2009, this is an implementation of the ‘Presenter’ part of the Model-View-Presenter (MVP) design pattern discussed in the video.
- google-gin: GIN (GWT INjection) brings automatic dependency injection to Google Web Toolkit client-side code. GIN is built on top of Guice and uses (a subset of) Guice’s binding language. By using GWT’s compile-time Generator support, GIN has little-to-no runtime overhead compared to manual DI.
If you are looking for an easy approach to use Spring in the backend with the gwt-dispatch project have a look at this posting:
If you are looking for a simple and concise approach to use autowire your Gwt-RPC servlets with components from the Spring application context, have a look at this posting:
- mvp4g: all-in-one approach providing annotation based Event Bus, Dependency Injection, Model View Presenter, Place Service