Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring + GWT or Spring vs GWT

Tags:

Background

I am in the middle of developing a web application using GWT, Java, and EclipseLink. Each of those selections are choices I have made to implement this program. GWT is the only choice where there is not a firm grasp as to what it is exactly compared to something like Spring. Right now I use GWT widgets to implement the client and GWT RequestFactory to implement the server-client communication of entities from EclipseLink.

Views

So I view GWT as primarily a library of widgets with a simple framework for server-client communication. This is much the same way I view Spring, a library of widgets with a much more advanced and complex framework for controlling server-client communications - with the possibility that it does not implement AJAX as conveniently as GWT does.

So with these in mind, I view GWT as a stepping-stone to understanding and eventually working with Spring. However, Google-ing on this topic again, I've come across several topics like this one and that one that seem to go against the original notions of what Spring is, and what that means for GWT.

The Questions

  1. Is there a misconception about the views on GWT and Spring? If so, some brief guiding points about that would be much appreciated!
  2. What would be the counter-part to GWT widgets in the Spring Framework?
  3. What would be the counter-part to GWT RequestFactory in the Spring Framework?
like image 647
hulkmeister Avatar asked Dec 04 '12 23:12

hulkmeister


People also ask

Why we use GWT?

Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. GWT is used by many products at Google, including Google AdWords and Orkut. GWT is an open source, completely free, and used by thousands of developers around the world.

How GWT works?

Compiler. Simply put, GWT compiler is a source translator from Java code into the Javascript. The result of the compilation is a Javascript application. The logic of its work includes trimming unused classes, methods, fields from the code and shortening Javascript names.

How does spring boot integrate with GWT?

Use GWT only for generating the Javascript code that is to be archived together with everything else into the executable jar. Use Spring Boot for REST endpoints and avoid GWT RPC completely. Use Spring Boot's executable jar to start the application and service the GWT html files with the embedded Tomcat.

Is go better than spring boot?

Conclusion. Looking at the response time results from Gatling, the mean time in all 3 operations is faster in Go. The response time for saving one product and retrieving the last product is around 20% faster in Go. And when retrieving the 20 latest products it is 133% faster in Go than in Java and Spring Boot Native.


1 Answers

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.

like image 174
Ümit Avatar answered Oct 09 '22 12:10

Ümit