Spring Boot + Angular 2 结构 [英] Spring Boot + Angular 2 structure
问题描述
在我的项目中,我想使用 Spring Boot
和 Angular 2.
Spring Boot App
的结构由在Angular 2 项目根目录中输入:
ng 构建
<小时>
(!请注意,这适用于 Angular CLI 工具中生成的 Angular 2 项目,对于不是由 Angular CLI 工具创建的 Angular 2 项目,outDir在 tsconfig.json 文件中编辑 )
In my project I want to use
Spring Boot
andAngular 2.
- Structure of
Spring Boot App
is done from Spring Initializer. - Structure of
Angular 2 App
is done byAngular CLI
tool (ng new myfrontendapp
)
In
Angular 1
you can put yourindex.html
into public folder.In
Angular 2
theindex.html
is generated insrc
folder and I would like to keep that structure.My question is what should I do to make
index.html
visible forSpring Boot
and keep the structure generated byAngular CLI.
Thanks for any answer.
解决方案Solution is to relocate build output of an Angular 2 project into Spring Boot /static or /public folder.
2 Steps:
- Set the outDir in .angular-cli.json file:
in the Angular 2 project root directory type:
ng build
(! Please note that this works for Angular 2 project generated in Angular CLI tool, for Angular 2 project not created by Angular CLI tool, the outDir is edited in tsconfig.json file )
这篇关于Spring Boot + Angular 2 结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!