Spring + GWT or Spring vs GWT Spring + GWT or Spring vs GWT spring spring

Spring + GWT or Spring vs GWT


It really depends on how you plan to use GWT in your application.

GWT is best used for single host page web-applications.
That means that all the flow synchronization and business logic is done on the client side using GWT.
This is where GWT really shines (see here for more details).

However if you go down this road, you will end up with basically two distinct applications. You will have a frontend developed with GWT and a backend using Spring for example. Your backend (Spring or whatever you use) will only act as a "data storage" providing you with data that you are going to display in your GWT frontend.So your will probably not using any of the Spring MVC's functionality.

Of course you can also use Spring MVC and use GWT only to add web 2.0ish functionality to your site, but for that use case I would recommend to rather use jQuery, Closure or other javascript frameworks.

To your questions:

Is there a misconception about the views on GWT and Spring? If so, some brief guiding points about that would be much appreciated!

If you use GWT as it is intended (single host page web-applications) then you won't use the MVC part of Spring. You can still use authorization, authentication, ORM and many other components of the Spring framework, however GWT handles all the views.
Spring acts more or less only as a data storage for your GWT frontend app. It's like having two distinct and separate apps that are connected through a communication protocol (RequestFactory, REST, RPC, etc).

What would be the counter-part to GWT widgets in the Spring Framework?

There is no real counter-part to GWT widgets in the Spring Framework (maybe to some extends JSF). Spring is all about the server-side so all the views there are created on the server side. Whereas GWT is all about client side.

What would be the counter-part to GWT RequestFactory in the Spring Framework

RequestFactory is the communication protocol between your frontend app (GWT) and your backend app (Spring). When you use Spring MVC you don't need any communication protocol as the views are generated on the server side where you already have the data.


GWT is not a widgets library, but an entire framework to produce full web applications which runs in client instead of server side. The basic difference is that spring (MVC pattern) is server focused, so it connects to the ddbb, executes the business logic and produces the view to send to the client, since GWT (MVP pattern) runs the presenter in the browser which produces the view, and it just connects to the server to get results or objects (remote methods).

Said that, depending on your GWT app, you could need more or less logic in the server side, and other elements like ddbb, spring, etc.

The decision about when to choose GWT or any other framework depends on whether you need a rich (desktop like) application running in browser.

Logically you can mix GWT and spring in any level of complexity, but the logical way is to give spring the responsibility of the data model and its business logic, and GWT doing the rest.

The best way to learn this combination is exploring a small project generated with Spring-roo. It can create an entire project with all set for maven, spring, gwt, mvp and rf. Just install roo 1.2.2 and run this set of commands in the roo console:

project --topLevelPackage com.project.contactspersistence setup --provider ECLIPSELINK --database HYPERSONIC_PERSISTENTdatabase properties set --key database.url --value jdbc:hsqldb:/var/tmp/contacts.dbentity jpa --class com.project.contacts.domain.Contact --testAutomaticallyfield string name --notNull --sizeMin 1 --sizeMax 30 --class ~.domain.Contactfield string surname --notNull --sizeMin 1 --sizeMax 30 --class ~.domain.Contactfield string phone --notNull --sizeMin 1 --sizeMax 15 --class ~.domain.Contactweb gwt setupweb gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.requestquit

Then execute

mvn gwt:run

The main problem I see with roo is that it uses 'aspectj' to update managed classed when you modify the model, but you could remove the roo dependency and aspectj files using eclipse once your project was set up.


Check out Objectify for your backend. Way simpler.