Convert Existing GWT Backend to SPRING BOOT

785 views
Skip to first unread message

viny...@gmail.com

unread,
Nov 21, 2022, 8:19:38 AM11/21/22
to GWT Users

We are having a huge project already running successfully on GWT.

But for some reasons we are planning to move our backend to SPRING-BOOT keeping front end in GWT. 

Is there any way we can do it easily without a big change in our existing application. 


Christian Nzhie

unread,
Nov 21, 2022, 8:57:01 AM11/21/22
to google-we...@googlegroups.com
My friend, I join this request as I am in the same process.

In my case, I am still migrating the have version first.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/c267bbb3-504f-41a8-896a-a2c2463eccdcn%40googlegroups.com.
--
Christian Nzhie.

Michael Conrad

unread,
Nov 21, 2022, 9:07:33 AM11/21/22
to google-we...@googlegroups.com
There are a lot of factors to consider.

Are you using gwt-RPC ? You'll need to switch to JSON for data transport.

You'll need to use something like DominoKit REST (https://github.com/DominoKit/domino-rest)  for the data transport layer.

It would be also be best to split the project into three projects. An API project, a shared code project, and a UI project.

If you are using gwt-RPC then IMHO there will need to be a big refactoring change at the very least.

Thomas Broyer

unread,
Nov 21, 2022, 9:35:41 AM11/21/22
to GWT Users
Can't you use your GWT-RPC servlets inside Spring Boot? (and only change them so you can have Spring inject dependencies into them so you can effectively rewrite the entire backend without touching the frontend at all)
Message has been deleted

viny...@gmail.com

unread,
Nov 21, 2022, 10:07:48 AM11/21/22
to GWT Users
Are you using gwt-RPC ?
Yes! we are using GWT-RPC & currently having a single WAR of near about 500mb, having CLIENT-SHARED-SERVER in a same project.

You'll need to switch to JSON for data transport.
Is there any drawback of switching to JSON in GWT, such as impact on performance etc.

You'll need to use something like DominoKit REST.
We found one RestyGWT, but not sure about its final impact as we haven't applied it yet. any suggestions...

It would be also be best to split the project into three projects. An API project, a shared code project, and a UI project.
We cannot get why keeping SHARED CODE as a separate project is best. We are not having any library of GWT on server side. So except MODELS, what are the other stuffs we can have in SHARED CODE PROJECT.   

If you are using gwt-RPC then IMHO there will need to be a big refactoring change at the very least
This is where we are stuck & looking for the solution with a minimum change and should be stable but unable to figure out yet. 

viny...@gmail.com

unread,
Nov 21, 2022, 10:19:22 AM11/21/22
to GWT Users

Sorry we cannot get you. We will face data data transport problem in this too. 

Michael Conrad

unread,
Nov 21, 2022, 10:50:29 AM11/21/22
to google-we...@googlegroups.com
Are you using gwt-RPC ?
Yes! we are using GWT-RPC & currently having a single WAR of near about 500mb, having CLIENT-SHARED-SERVER in a same project.
You can still have everything in a master parent project that builds the final WAR with all the client JS and SERVER classes in the same war.


You'll need to switch to JSON for data transport.
Is there any drawback of switching to JSON in GWT, such as impact on performance etc.
You lose easy polymorphism for models, they will require an extra set of annotations at the very least if you have polymorphism as part of your DTO setup.


You'll need to use something like DominoKit REST.
We found one RestyGWT, but not sure about its final impact as we haven't applied it yet. any suggestions...
RestyGWT is effectively defunct. Stick with a modern GWT3 compatible approach such as DominoKit.



It would be also be best to split the project into three projects. An API project, a shared code project, and a UI project.
We cannot get why keeping SHARED CODE as a separate project is best. We are not having any library of GWT on server side. So except MODELS, what are the other stuffs we can have in SHARED CODE PROJECT.  
In this case SHARED CODE is really just the MODELS and INTERFACES and possible the REST Interface.


If you are using gwt-RPC then IMHO there will need to be a big refactoring change at the very least
This is where we are stuck & looking for the solution with a minimum change and should be stable but unable to figure out yet.
I don't think you can accomplish this with a large project with minimum of change unless the client API calls are fully abstracted away (or can be) so that code could be replaced with a different class.

On Monday, November 21, 2022 at 7:37:33 PM UTC+5:30 Michael Joyner wrote:
There are a lot of factors to consider.

Are you using gwt-RPC ? You'll need to switch to JSON for data transport.

You'll need to use something like DominoKit REST (https://github.com/DominoKit/domino-rest)  for the data transport layer.

It would be also be best to split the project into three projects. An API project, a shared code project, and a UI project.

If you are using gwt-RPC then IMHO there will need to be a big refactoring change at the very least.


On 11/21/22 08:19, viny...@gmail.com wrote:

We are having a huge project already running successfully on GWT.

But for some reasons we are planning to move our backend to SPRING-BOOT keeping front end in GWT. 

Is there any way we can do it easily without a big change in our existing application. 


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/c267bbb3-504f-41a8-896a-a2c2463eccdcn%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.

lofid...@gmail.com

unread,
Dec 5, 2022, 5:00:26 PM12/5/22
to GWT Users
Hi All, 

you don't have to move GWT RPC to REST and JSON when you want to move the backend to Spring Boot. GWT RPC is just a servlet which you can register in Spring Boot.

Here are some examples of the standard GWT Demo StockWatcher but implemented using Spring Boot with GWT RPC and REST JSON:



(2) This example shows to integrate the GWT RPC servlet to Spring Boot, but I think doesn't work so far. I could take a look if you want to.


Cheers,
Lofi

Leon Pennings

unread,
Dec 6, 2022, 8:27:51 AM12/6/22
to GWT Users
In addition to previous poster -> yes you can keep on using the GWT RPC. 

The things I had to change in order to keep it working when packaging the spring boot jar, was;
1 - to make sure Spring Boot runs the servlets (enough on the web for that)
2 - to make sure the gwt compile ends up in de classes folder before the .jar is created 
3 - to make sure the servlet can access the .gwt.rpc file to validate the servlet calls. 
Normally that is available to the servlet from the war package, but since it's a jar with Spring boot you need to make some changes;
For that I had to override the RemoteServiceServlet method;

@Override
protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest request, String moduleBaseURL, String strongName) {
          return SerializationPolicyLoader.loadFromStream(new ClassPathResource("classpath:yourLocation/" + strongName+".gwt.rpc").getInputStream(), null);
}

So the changes are quite limited and not as much Spring boot specific, but more the oddities of changing the package format from a .war to a .jar
That was all -> runs like a charm
Op maandag 5 december 2022 om 23:00:26 UTC+1 schreef lofid...@gmail.com:

Dr. Lofi Dewanto

unread,
Dec 6, 2022, 6:57:27 PM12/6/22
to google-we...@googlegroups.com
Thanks a lot for the tips on Spring Boot packaging in JAR. 

Yes, the first example I showed was with packaging WAR. That works fine.

I would try your tips to be able to run on the JAR packaging (second example).

I'll tell you, whether I'm successful or not. 

It is weird, that I could run the RemoteLoggingServiceImpl.java for GWT logger on the JAR packaging but not the RemoteServlet.

Thanks,
Lofi 

You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/13cHZX5KoQA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/5535048c-bbc2-4f58-8cf4-11025a166464n%40googlegroups.com.

Eric Dufresne

unread,
Oct 16, 2023, 6:20:00 PM10/16/23
to GWT Users
Hi!

Were you successful in building out a JAR using spring boot while still using GWT RPC? I am on the last step of getting the `.gwt.rpc` files in the right place but I still get serialization errors saying the serialization policy files are missing. 

For the override you did:
@Override
protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest request, String moduleBaseURL, String strongName) {
          return SerializationPolicyLoader.loadFromStream(new ClassPathResource("classpath:yourLocation/" + strongName+".gwt.rpc").getInputStream(), null);
}

where in the JAR did you add the gwt.rpc files and how did you access them from here?

Any help would be greatly appreciated.

Thanks!

Leon

unread,
Oct 17, 2023, 12:49:13 AM10/17/23
to google-we...@googlegroups.com
Hey Eric,

I did this and it worked out of the box;
@Override
    protected SerializationPolicy doGetSerializationPolicy(HttpServletRequest request, String moduleBaseURL, String strongName) {
        try {
            return SerializationPolicyLoader.loadFromStream(new ClassPathResource("classpath:public/my_compile_folder_name/" + strongName+".gwt.rpc").getInputStream(), null);
        } catch (Exception e) {
            LOGGER.error("Error loading Serialization policy - peeps with outdated application version");
            return null;
        }
    }

Eric Dufresne

unread,
Oct 17, 2023, 1:45:20 PM10/17/23
to GWT Users
That did the trick. In my pom.xml I had my `deploy` location as `<deploy>${project.build.directory}/gwt-deploy</deploy>` but I guess that isn't on the classpath so moving it to ${project.build.directory}/public/gwt-deploy (which I believe is automatically on Spring's classpath) worked. Was able to get rid of the classpath: prefix as well. 

Ty for the help Leon! 

Leon

unread,
Oct 17, 2023, 1:51:26 PM10/17/23
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages