This is a multi-module Spring Boot Angular Maven starter app with good defaults. The frontend Angular app is built using angular-cli. The project packages Angular application code as a WebJar. This project is geared towards building monolithic applications. I have also written a blog that explains step by step how to create this starter project.
This project provides productive setup for building Spring Boot Angular applications. The application is divided into two Maven modules:
backend
: This contains Java code of the application.frontend
: This contains source code for the Angular based frontend.
This project uses following versions:
- Spring Boot v2.0.1
- Angular v5.2.10
- Node v8.9.0
- Yarn v1.3.2
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 backend/target/ngboot-app.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.
- ErrorProne: Find errors in your code.
- Frontend packaged as a WebJar.
- CORS enabled: A global configuration is added to enable CORS so that frontend can work seamlessly with backend during development.
- REST API base path: Sets the base REST API path to
/api
. You can configure it by changingrest.api.base.path
property. - Maven release plugin
- CI: The project is preconfigured to use TravisCI as continuous integration server.
There are multiple ways to run the backend. For development, you can use your favorite IDE and run the
com.example.app.Application
. As soon as your code compiles, Spring Boot DevTools will reload the code.
You can also run the application using Maven.
$ cd backend
$ ../mvnw spring-boot:run
Make sure to install yarn on your development machine.
To install all the required binaries for your project, you can run following command.
$ cd frontend
$ ../mvnw frontend:install-node-and-yarn frontend:yarn
Once the above command finishes, you can start the frontend using the yarn start
command.
Both the front-end and back-end modules support hot reloading.