Giter VIP home page Giter VIP logo

spring-boot-maven-angular-starter's Introduction

spring-boot-maven-angular-starter Build Status

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:

  1. backend: This contains Java code of the application.
  2. ui: This contains source code for the Angular based frontend.

This project uses following versions:

  1. Spring Boot v2.2.6.RELEASE
  2. Angular v9.1.1
  3. Node v12.16.2

Running the full application

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/app.jar

The application will be accessible at http://localhost:8080.

Features

This starter comes bundled with the following features:

  1. Multi module Maven project: A multi module project to modularize backend and frontend code separately.
  2. Maven wrapper: So, you don't need to install Maven on your machine.
  3. Checkstyle: Enforce sane coding standard guidelines.
  4. ErrorProne: Find errors in your code.
  5. Frontend packaged as a WebJar.
  6. CORS enabled: A global configuration is added to enable CORS so that frontend can work seamlessly with backend during development.
  7. REST API base path: Sets the base REST API path to /api. You can configure it by changing rest.api.base.path property.
  8. Maven release plugin
  9. CI: The project is preconfigured to use TravisCI as continuous integration server.

Running the backend for development mode

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

Running the frontend for development mode

To install all the required binaries for your project, you can run following command.

$ cd frontend
$ ../mvnw frontend:install-node-and-npm

Once the above command finishes, you can start the frontend using the npm run serve command.

Hot reloading

Both the front-end and back-end modules support hot reloading.

Example Application

Following are the example applications built using this starter

  1. boot-angular-pagination-example-app

spring-boot-maven-angular-starter's People

Contributors

shekhargulati avatar varunu28 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-boot-maven-angular-starter's Issues

Error after cloning the project and performing a ./mvnw clean install

@shekhargulati I cloned the spring-boot-maven-angular-starter project and when I ran './mvnw clean install' I receive the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project backend: Fatal error compiling: CompilerException: InvocationTargetException: java.nio.file.NotDirectoryException: /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/lib/modules -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project backend: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)

Error on trying to start backend

When I try mvnw spring-boot:run

[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-boot-angular-starter 0.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) > test-compile @ spring-boot-angular-starter >>>
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) < test-compile @ spring-boot-angular-starter <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) @ spring-boot-angular-starter ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] spring-boot-angular-starter ........................ FAILURE [  6.047 s]
[INFO] frontend ........................................... SKIPPED
[INFO] backend ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.597 s
[INFO] Finished at: 2018-01-31T08:19:10-02:00
[INFO] Final Memory: 20M/167M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) on project spring-boot-angular-starter: Unable to find a suitable main class, please add a 'mainClass' property -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

frontend should call backend

Perhaps I am missing something. I can't see the frontend ever actually hitting the backend service.

I would think that a point of a combined application like this would be that the frontend presents data that's from the backend. Getting this set up in a relocatable way is a bit of a nuisance. So, a clear example would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.