This is a demo project to show Spring Boot in conjunction with GWT. It uses the latest dependencies (Spring Boot 2.0.1 and GWT 2.8.2) and Java 8. The deployed app can be found here.
To run this project you have to start Spring Boot and GWT separate. If you use IntelliJ, see the IDEA Settings readme for the correct configuration.
Spring Boot can also be started with gradle.
gradlew bootRun
Currently only the server side code is tested. To run the tests use the following command
gradlew test
We use Spock as testing framework because of the great readability, syntax and built in features.
To check for outdated dependencies
gradlew dependencyUpdates -Drevision=release
The project con be build to a single jar file with an embedded tomcat:
gradlew clean build
After gradle build the project the finished jar file is in build/libs/spring-boot-gwt-1.0.0.jar
and can simply be started with
java -jar build/libs/spring-boot-gwt-1.0.0.jar
To deploy this app to heroku use the Deploy to Heroku Button on the top.
Heroku uses the gradle stage
task to build the project. Because Spring Boot puts everything we
need into the jar file we only have to tell heroku to execute this jar file.
The client side and server side are strictly separated. The GWT files are in the client
package
(except the .gwt.xml
) and the server side code is in the server
package. All static client code
like the index.html
and css files are inside the static
folder. Gradle
will also put the compiled sources in this folder.
The communication is made via JSON for which reason we have make 2 implementations of the object we send (POJO in the frontend and POJO with javax annotations in the backend).