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

Mar*_*o90 10 java rest spring spring-mvc angular

我想将一个Angular 4客户端应用程序与Java Spring应用程序集成,http://localhost:8080/并提供一些Rest端点.我的目标是能够从URL中调用Angular应用程序http://localhost:8080/adminisitration.我怎样才能做到这一点?

提前致谢,

Aks*_*ava 5

您将需要生成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.
Run Code Online (Sandbox Code Playgroud)

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

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