如何将Angular 4应用程序与Spring Boot堆栈集成在一起?


问题内容

我想将Angular 4客户端应用程序与正在运行http://localhost:8080/并提供一些Rest终结点的Java
Spring应用程序集成在一起。我的目标是能够从类似的网址调用Angular应用http://localhost:8080/adminisitration。我怎样才能做到这一点?

提前致谢,


问题答案:

您将需要生成ng应用并将其放置在spring-boot文件夹中

1. Create a public folder under resources in your spring-boot project

2. ng build --prod, type this command on you angular project which will create a dist folder under your angular project directory

3. copy files from you dist folder and place it in public folder under resources of your spring-boot project.

这将帮助您在spring-boot下运行angular-app。

然后点击http:// localhost:8080 /
adminisitration
,它应该可以正常工作