/spring-react-boilerplate

An example of an isomorphic application using Java + Spring with React, React Router and Redux

Primary LanguageJava

spring-react-boilerplate

An example application that uses a Spring Java backend with a React frontend.

Another Boilerplate?

Yes, but with Java. It's inspired by the spring-react-isomorphic project, but uses:

  • Webpack to bundle all the JavaScript and dependencies, plus LESS + CSS handling.
  • Babel for ES6 syntax, using Babel 6 with the "es2016" and "react" presets.
  • Hot module reloading (HMR) of React components
  • Redux to manage state, both in the client and when rendering on the server.
  • react-router for page routing, on client and server
  • Linting integrated with Webpack via eslint.

Other Goodies

You also get:

Caveats

This isn't necessarily the best way to write a React application. Pull requests welcome!

Running the code

Execute mvn if you have Maven already installed, or ./mvnw if you don't. You'll need Java8 installed either way at a minimum version of 1.8.0_65.

Run webpack in hot-module reloading mode with: npm run watch.

Conventions

Controllers that render views are suffixed with "Controller". REST endpoints are suffixed with "Resource", and handle requests under "/api".