简体   繁体   中英

How to Reduce Build Time with Angular 2 within Java EE Spring Boot Web App

I am building an angular 2 java EE spring boot web application within eclipse neon. For development reasons, I wanted to simply keep my angular files within my java project, but this is looking like a bad idea, since the node_modules folder for the angular 2 source is the meat of the angular source (over 150 MB), it is causing my project to build and run extremely slowly.

What is the best way to keep my angular files outside of my java project and connect to it via spring boot and java? What is the preferred method? Thanks!

I faced this problem while ago. i solved like this

  • create your spring boot in STS or Eclipse
  • write your Angular app in VS code IDE ( its awesome )

To use consume REST service created by Spring Project in Angular use proxy.conf.json.

{
“/spirngapi” :{
“target” : “http://localhost:8080”,
“secure” : false
}
}

this will redirect Angular http calls to your spring application file.

For production you can generate production build in Angular and Copy file in to war file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM