An example application that uses a Spring Java backend with a React frontend.
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.
You also get:
- Project Lombok to cut down the Java boilerplate
- Jackson to serialize model data before rendering on the server. For more information, see this OpenJDK thread on the subject
This isn't necessarily the best way to write a React application. Pull requests welcome!
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
.
Controllers that render views are suffixed with "Controller". REST endpoints are suffixed with "Resource", and handle requests under "/api".