Experiences with integrating spring 3 mvc with GWT? Experiences with integrating spring 3 mvc with GWT? ajax ajax

Experiences with integrating spring 3 mvc with GWT?


Can you share experiences with using Spring 3.0 mvc with GWT ?

Yes. We've successfully built a whole large application around GWT and Spring MVC (1500 source files, 6 months in development).

Spring was the key to the project's success. Only with Spring we were able to test individually some pieces of the application on the server side.

What is the best approach to marry these two frameworks?

Ignore the default Servlet used by GWT and instead create your own Spring controller to handle incoming GWT-RPC requests. This blog post was the key to integrating the two techs.

We also successfully integrated other components: Flash for animated charts and third-party Javascript components for other stuff. These communicate with the server through JSON. So you have two or more kinds of URLs:

  • the *.rpc urls are for GWT components and are served by the Spring controller for gwt
  • the *.json urls are for other components and are served by another Spring controller.

Also, in our case, we shunned configuration with annotations and instead preferred configuration with the good old Spring XML files. They make it much more clear what's going on. Except for the @Required annotation; it's great to find spring beans that should be connected but aren't.

Is the default GWT's MVP architecture only for client side and does it work well with JSON?

GWT's MVP architecture works best if you follow the guide lines. Use GWT-RPC communication as Google suggests.

You can still have JSON for other client-side components.


Try this solution: GWT and Spring MVC Integration

It uses 3 classes. Its very simple, declarative and clear.


It's stupid to mix Spring MVC and GWT. Also it's stupid to mix Spring MVC and JSF... It's stupid to mix 2 MVC (MVP) frameworks together. But you can use Spring DI and GWT for sure!