我在一个项目中有两个模块,第一个模块是前端应用程序 (Angular CLI 8)
,第二个后端 Spring boot 应用程序。我正在尝试使用 Maven 一起部署这两个模块。
所以我自动将 dist 文件夹从前端应用程序复制到后端资源。
在 Angular 生成的文件中:index.html
我有这样的 css 文件的源代码:
<link rel="stylesheet" href="styles.css">
但我需要这样的东西:
<link rel="stylesheet" th:href="@{styles.css}">
如何在 dist
包中配置我想要的自动生成的 Angular 。
最佳答案
要使用 Angular
构建前端应用程序并使用 Spring boot
构建后端应用程序,我只能建议您在 Jhipster
上抢劫。
Hipster is a development platform to generate, develop and deploy Spring Boot + Angular / React / Vue Web applications and Spring microservices.
我经常使用 JHipster 来学习构建、监控、部署、安全、最佳实践等新知识。
他们为使 Angular 与 Spring Boot 相处得很好做了很多事情。
存储库示例:https://github.com/jhipster/jhipster-sample-app
您需要做的是设置 Angular 配置以将目标文件夹设置为 target/classes/static
然后将配置添加到 spring boot 以重定向到 Assets 。
关于html - 如何获得:href ="@{}" instead of href ="" in links spring boot/angular app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57398509/