This boilerplate project demonstrates how to render ReactJS components in a Spring Boot web application using Thymeleaf.
This project demonstrates how to integrate ReactJS with a Spring Boot web application using Thymeleaf. The core concept is to copy the static build output from the ReactJS project into the static resources folder of the Spring Boot application. React components are rendered by attaching multiple root elements to corresponding HTML DOM nodes, each identified by an section-* prefix.
- Backend
- Spring Boot
- Thymeleaf Template Engine
- Frontend
- React
- TypeScript
- JDK 17+
- Node 20+
- react-common
- A common React project that copies its build output to both
spring-boot-java-reactandspring-boot-kotlin-react.
- A common React project that copies its build output to both
- spring-boot-java-react
- A Java-based Spring Boot project that uses the build output from
react-common.
- A Java-based Spring Boot project that uses the build output from
- spring-boot-kotlin-react
- A Kotlin-based Spring Boot project that uses the build output from
react-common.
- A Kotlin-based Spring Boot project that uses the build output from
You can run either the Java or Kotlin project, depending on your preference.
npm install -g yarn # If yarn is not installed
cd react-common
yarn install
yarn build- Default server port: 8080
cd spring-boot-java-react
./gradlew bootRun- Default server port: 8081
cd spring-boot-kotlin-react
./gradlew bootRun