Spring Boot & React.js project template

Konstantin Nalum
Jul 20, 2017 · 1 min read

Building modern web services usually involves a frontend and backend component. Here, a project template using Spring Boot for the backend and React.js (based on webpack and create-react-app ) for frontend is presented. Both are part of the same project. The maven build bundles the whole application to a single JAR file.

Build process:

  1. Run unit tests
  2. Build optimized production build (webpack)
  3. Bundle frontend and backend components into a single JAR

Obtain the project:

git clone https://github.com/knalum/spring-react.git

Run development mode:

  1. Navigate to src/main/frontend and run
    yarn install
  2. Open the pom.xml file in your IDE and run the application
  3. Navigate to the src/main/frontend folder (where package.json is located) and run
    yarn start
  4. Open http://localhost:3000

In development mode, changes to frontend are applied immediately using hot reload

Build for production:

Get a bundled JAR by running:

mvn clean install

Run jar file and open http://localhost:8080 to open the web app.

)

Konstantin Nalum

Written by

Software engineer located in Oslo

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade