Languages
[Edit]
EN

Angular - build angular project for production (npm package prod) with spring boot app

9 points
Created by:
AnnLen
11260

1. Build Angular project for production

From the root of our our_project_name run command:

ng build --prod

angular will output the results of the build to:

dist/our_project_name/

2. Build package angular dist with spring boot

Copy the dist/our_project_name/
Copy only the content of 'dist/our_project_name/' without dir 'our_project_name'

to spring project under path:
spring_project_name/src/main/resources/static

Run:

mvn install

in target dir we will get jar:
spring_project_name.jar

Run jar from cmd:

java -jar spring_project_name.jar

- and we will have frontend served from spring project
the application port is the same as specified in application.properties eg:
server.port=8081

Default spring boot port if not specified is 8080

Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join