Packaging a React App With Spring Boot

In this article, we're going to discuss how to combine Create React App with Spring Boot to give you a single war file, so that we:

  • Can have our frontend and backend in a single war file with optimized productions build
  • And keep the benefits Create React App gives such as hot reloading

Setup

  1. Must have Java installed. Head over here to download a version.
  2. Must have Maven installed. For Mac, I used Homebrew (brew install maven), but otherwise, head here.
  3. Must have Node installed. For Mac, I used Homebrew (brew install node), but otherwise, head over here.

Note: my IDE of choice is IntelliJ. When working on react code, I usually switch over to VS Code. Feel free to use what makes you feel comfortable.