Wednesday, February 28th, 2007

GWT-Spring Integration Demystified

Category: Framework, GWT, Java

Gabi S. in what appears to be her first blog post has already started off with a bang. In tutorial form she shows how to integrate GWT with Spring.

To integrate [the GWT application] with Spring we only have to register our GWT servlet in our web.xml so we can simply use Spring’s ServletForwardingController to call services by name. We also have to modify a bit our GWT client to reflect a path change we have to do…The ServletWrappingController [defined in the Spring application context] controls the RemoteServiceServlet’s lifecycle completely, emulating the servlet-container.

So once you have instantiated your GWT services with Spring, you are free to use all of that good stuff, like inversion of control (IoC), aspect oriented programming (AOP), etc. For those wanting a quick overview of Spring, the “swiss army chainsaw of Java and .NET frameworks,” have a look here.

Note: we are using Spring on the server side here, not the client side. For IoC in the browser, see the earlier post on JDA.

Update: The misspelling of “Demystified” in the referenced blog post did not trigger the inner speller in me. It has been fixed.

Posted by Dietrich Kappe at 9:30 am

4 rating from 43 votes


Comments feed TrackBack URI

*Demystified ;)

Comment by Joshua Jonah — February 28, 2007

Yah, exactly. After many years of Spring/J2EE, I’d say that ‘demystifying’ has now reached marketing status and no longer exists as a layman term. In fact – well, never mind, I won’t go down the Spring/J2EE road. *shudders*

Comment by j_l — February 28, 2007

Demistified ?
It’s time to use Spellify !!!

Comment by jcm — February 28, 2007

The Java EE makes us to use so many XML deployment descriptors and XML configuration files. This is the real issue . Nothing to demystify here – just get rid of the XML stuff.

Comment by Jan — March 6, 2007

I agree that Java EE has historically used too much XML but I like Spring’s approach to declare IoC using XML as all my beans are in one XML file. If my dependencies were declared, lets say using annotations, then the declarations would be decentralized.

Comment by James Perry — November 10, 2007

I have posted a very simple way of doing the GWT – Spring integration:

This approach is beeing used in many projects I setup.

Comment by techscouting — August 11, 2009

Before you start wiring up beans as Gwt-RPC endpoints or start creating lots of RPC services making calls to the backend, have a look at the command pattern approach described Ray Ryan at his talk at the Google IO. At the end, all you need is one single service, without loosing type safety.

A wrap up with link to the talk (video) and to the projects that either already where there b4 Ryans talk or were created upon the talk can be found here:

There you will find a link to posting showing a very simple and concise way to use Spring in the backend with gwt-dispatch.

Have fun!

Comment by techscouting — September 18, 2009

Leave a comment

You must be logged in to post a comment.