This is a multi-module Spring Boot React Apache Maven starter app with good defaults. The react app is built using create-react-app.
This project provides a productive setup for building Spring Boot React applications. The application is divided into two Maven modules:
api
: This contains Java code of the application.ui
: This contains all react JavaScript code of the application.
You can build the package as a single artifact by running the ./mvnw clean install
.
Next, you can run the application by executing:
$ java -jar api/target/api-0.1.0-SNAPSHOT.jar
The application will be accessible at http://localhost:8080
.
This starter comes bundled with the following features:
- Multi module Maven project: A multi module project to modularize backend and frontend code separately.
- Maven wrapper: So, you don't need to install Maven on your machine.
- Checkstyle: Enforce sane coding standard guidelines.
- CORS enabled: A global configuration is added to enable CORS so that frontend can work seamlessly with backend during development.
There are multiple ways to run the backend. For development, you can use your favorite IDE and run the
com.xebia.starter.Application
. As soon as your code compiles, Spring Boot DevTools will reload the code.
You can also run the application using Maven.
$ cd api
$ ../mvnw spring-boot:run
You will need Node 12+ and npm to run the dev server and build the project.
$ cd ui
$ npm start
To build the docker images and start the containers using Docker Compose run the following command. This will work in the *nix systems.
$ sh docker.sh
You can view running docker containers by executing following command.
$ docker ps
To stop and remove all docker container you have to run following command. This command should be run from project root.
$ docker-compose stop && docker-compose rm --force