简体   繁体   English

如何在Java EE Spring Boot Web App中使用Angular 2减少构建时间

[英]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 我这样解决了

  • create your spring boot in STS or Eclipse 在STS或Eclipse中创建您的Spring Boot
  • write your Angular app in VS code IDE ( its awesome ) 在VS Code IDE中编写您的Angular应用程序(真棒)

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.

相关问题 Spring Boot Web应用程序中的Angular 2文件 - Angular 2 Files within Spring Boot Web Application 如何使用Java EE后端Maven构建和Glassfish服务器运行Angular2应用程序? - How do I run Angular2 app with java EE backend maven build and glassfish server? 在Web应用程序Java EE / Spring的一部分上实现自定义安全性/过滤器 - Implement custom security/filters on a part of a web app Java EE/Spring 如何在 Java EE 和 Spring Boot 中热重载属性? - How to hot-reload properties in Java EE and Spring Boot? 将Java Web应用程序迁移到Spring Boot吗? - Migrate java web app to spring boot? 如何在spring boot 2中使用groovy解释(使用spring-aop注释)2使用maven构建java应用程序? - How to use groovy interpreted (with spring-aop annotation) within an spring boot 2 java application build with maven? Java EE Web App防火墙 - Java EE Web App Firewall 如何在 IDE 中的 docker 镜像中在 Intellij IDEA 中构建 spring boot 应用程序? - How to build spring boot app in Intellij IDEA in a docker image within the IDE? 如何在Java EE中获取当前Web应用程序的名称? - How can I get the name of the current web app in Java EE? 使用Spring Boot构建基本Web应用程序的不同方法? - Different approaches to build basic web app with spring boot?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM