This is a multi-module Spring Boot Angular Maven project that allows to create archetype. 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.
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.1.5
- Angular v8.0.0
- Node v12.4.0
- Npm v6.9.0
In root of project run
1. mvn archetype:create-from-project -Darchetype.filteredExtensions=java
2. cd target/generated-sources/archetype/
3. mvn install
1. Create folder for your project example: mkdir /tmp/archetype/
2. Change directory to created folder example: cd /tmp/archetype/
3. mvn archetype:generate -DarchetypeCatalog=local
4. Choose com.akulinski.springbootstarter:spring-boot-angular-starter-archetype
5. Enter data needed for project generation
6. Voilà
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.
- 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
$ cd frontend
$ ng serve
Both the front-end and back-end modules support hot reloading.