Companion code for the Tucanoo tutorial GSP Without Grails: Groovy Server Pages as the View Layer of a Spring Boot 4 App.
Grails 8 lets an ordinary Spring Boot application render its views with GSP. There's no Grails application involved: Spring MVC controllers return view names, and GSP renders them. This repo is a small quest board for the Knights of the Round Table, built twice so you can compare the two view layers on the same app.
Built and tested with Java 21, Spring Boot 4.1.1 and Grails 8.0.0-RC1. RC1 is a release candidate, so expect coordinates and versions to move when 8.0.0 is released.
gsp-app is the tutorial app. Controllers, entities and repositories are plain Java. The views are GSP pages under src/main/resources/templates, with a SiteMesh layout, a partial, and a small Groovy tag library (QuestTagLib) for the status badges and peril pips. Bootstrap is compiled in by the asset pipeline.
thymeleaf-twin is the same app with Thymeleaf and the Layout Dialect. Controllers, entities and repositories are identical; only the views and the custom tags differ. It exists for the comparison in the article and isn't covered step by step.
Both start with the same seeded data (import.sql) on an in-memory H2 database.
From either project directory:
./gradlew bootRun
Then open http://localhost:8080.
One thing to know about gsp-app: when it runs from its own project directory, GSP renders the templates straight from src/main/resources/templates. That's handy, because edits show up without a restart. Run the packaged jar from anywhere else and it uses the pages compiled at build time instead:
./gradlew bootJar
cd /somewhere/else
java -jar /path/to/gsp-app/build/libs/gsp-app-0.0.1-SNAPSHOT.jar
./gradlew test
Both projects run the same five integration tests against a real port. The gsp-app tests set spring.gsp.templateRoots=classpath:/templates so they exercise the compiled pages, as the jar does.
If you're following the RC1 reference guide alongside this, its build snippet uses org.apache.grails.views:grails-gsp-spring-boot, which isn't on Maven Central. The artifact is org.apache.grails:grails-gsp-spring-boot, and the build also needs the java and groovy plugins applied. gsp-app/build.gradle has the working version.