How to integrate an Angular 4 app with a Spring Boot stack?

You would need to prod build your ng app and place that in spring-boot folder:

  1. Create a public folder under resources in your spring-boot project

  2. ng build --prod, type this command on you angular project which will create a dist folder under your angular project directory

  3. Copy files from you dist folder and place it in public folder under resources of your spring-boot project.

This will help you run your angular-app under spring-boot.

Then hit http://localhost:8080/adminisitration, it should work fine


There are two ways first is that you serve angular app from your spring boot application as static resources so you need to pack it into jar and that's not easy when you have two different repositories for frontend and backend and doesn't look to good from maintenance point of view.

Second is that you have angular static resources on nginx and spring boot app is reachable to angular thru reverse proxy configured on nginx like

location /api/ {
    proxy_pass http://localhost:8080/api/;
}

So when angular asks for GET http://localhost/api/somerest it forwards it to GET http://localhost:8080/api/somerest