如何将Angular 4应用程序与Spring Boot堆栈集成? [英] How to integrate an Angular 4 app with a Spring Boot stack?
问题描述
我想将一个Angular 4客户端应用程序与一个处理 http:// localhost:8080 /
的Java Spring应用程序集成,并提供一些Rest端点。
我的目标是能够从 http:// localhost:8080 / adminisitration
这样的网址调用Angular应用程序。我怎么能这样做?
i would like to integrate an Angular 4 client app with a Java Spring application working on http://localhost:8080/
and offering some Rest endpoints.
My goal is to be able to call the Angular app from a url like http://localhost:8080/adminisitration
. How can I do that?
提前致谢,
推荐答案
您需要激活构建您的ng应用程序并将其放在spring-boot文件夹中
You would need to prod build your ng app and place that in spring-boot folder
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。
This will help you run your angular-app under spring-boot.
然后点击 http:// localhost:8080 / adminisitration ,它应该可以正常工作
then hit http://localhost:8080/adminisitration, it should work fine
这篇关于如何将Angular 4应用程序与Spring Boot堆栈集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!