Spring Boot-如何提供Angular2编译文件 [英] Spring Boot - How To Serve Angular2 Compiled Files

查看:62
本文介绍了Spring Boot-如何提供Angular2编译文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由Spring Boot完成的宁静服务器,对于前端,我有一个由Angular2创建的应用程序.我一直在尝试将前端文件放在tomcat上,这样我就不需要单独提供它们,但是我无法管理它们.

I have a restful server done with Spring Boot and for front-end i have an application created by Angular2. I have been trying to put frontend files on tomcat so that i wont need to serve them separately however i couldn't manage that.

我在Angular2前端项目的/dist文件夹中有文件.但是无论我在哪里放置,Spring都不会为他们服务.如何做到这一点?

I have the files in /dist folder from Angular2 front-end project. But no matter where i place it, Spring wouldn't serve them. How can manage to do this?

推荐答案

我的建议是将其放在src/main/resources/static/.

请参阅, https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot 以获得更多信息.

Refer, https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot for more on this.

我在相同的代码库中有一个弹簧靴和angular 2项目,用于实验.请以这个为例.

I have an spring boot and angular 2 project put in same codebase for experiment. Please use this as example.

https://github.com/reflexdemon/shop

这篇关于Spring Boot-如何提供Angular2编译文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆