[英]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. 我正在eclipse neon中构建一个angular 2 java EE spring boot web应用程序。 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. 出于开发原因,我只想将我的角度文件保留在我的java项目中,但这似乎是一个坏主意,因为角度2源的node_modules文件夹是角度源的主要内容(超过150 MB),因此导致我的项目构建和运行非常缓慢。
What is the best way to keep my angular files outside of my java project and connect to it via spring boot and java? 将我的Angular文件保留在java项目之外并通过spring boot和java连接到它的最佳方法是什么? What is the preferred method? 首选方法是什么? Thanks! 谢谢!
I faced this problem while ago. 我刚才遇到了这个问题。 i solved like this 我这样解决了
To use consume REST service created by Spring Project in Angular use proxy.conf.json. 要使用由Spring Project在Angular中创建的消耗REST服务,请使用proxy.conf.json。
{
“/spirngapi” :{
“target” : “http://localhost:8080”,
“secure” : false
}
}
this will redirect Angular http calls to your spring application file. 这会将Angular http调用重定向到您的spring应用程序文件。
For production you can generate production build in Angular and Copy file in to war file. 对于生产,您可以在Angular中生成生产版本,然后将文件复制到war文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.