JHipster/Angular配置如何确定需要使用index.html文件?

How does the JHipster/Angular configuration determines that it needs to use the index.html file?

我刚刚使用 JHipster 生成了一个 Spring/Angular 应用程序。

我使用此 URL 成功访问了主页:http://localhost:8080 重定向到 http://localhost:8080/#/ 并且 index.html 文件已正确加载。

我不确定 Angular 和浏览器如何确定它们需要加载 index.html 文件。

这是在 JHipster 应用中的何处配置的?

编辑:是否有一些"default home page"配置?

I successfully accessed the home page by using this URL: http://localhost:8080 which redirects to http://localhost:8080/#/

向服务器请求“/”,index.html得到服务。 “/#/”是当 index.html 页面上的 javascript 启动时发生的所有客户端内容(Angular 路由),而不是服务器端重定向的结果。

Where is this configured in a JHipster app?

这是 Spring 启动默认值,不是 JHipster 特有的。来自 Spring Boot docs:

The auto-configuration adds the following features on top of Spring’s defaults:

  • Static index.html support.

By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext. It uses the ResourceHttpRequestHandler from Spring MVC so you can modify that behavior by adding your own WebMvcConfigurerAdapter and overriding the addResourceHandlers method.

我认为这无法通过 属性 文件或类似文件进行配置,您必须编写一些代码。见 answer to this question.