Languages
[Edit]
EN

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

9 points
Created by:
AnnLen
9180

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
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join