【问题标题】:When using Spring + Spring Boot + STS, where in the Spring Project directory is the localhost "home" folder?使用 Spring + Spring Boot + STS 时,Spring Project 目录中的 localhost “home” 文件夹在哪里?
【发布时间】:2015-02-08 02:18:29
【问题描述】:

我正在使用 Spring/Spring Boot/和 Ember。我想将我的 index.html 文件放在“localhost”主文件夹中,但我不知道 Spring Tool Suite 如何部署 Spring Boot。 HTML 开发和访问 Spring REST 服务器而不会出现跨站点脚本错误的正常流程是什么?

我的文件夹结构如下:

/.settings
/BookingClient
/gradle
/html  (this is where my index.html, css, and all Ember related JS stuff is)
/node_modules
/src
/target

我猜它在 /target 目录中的某个地方,但我尝试过的没有任何效果。

【问题讨论】:

    标签: spring ember.js spring-boot


    【解决方案1】:

    Spring Boot 将为您提供静态资源。只需将它们放入src/main/resources/static。有关更多信息,请参阅documentation on static content

    【讨论】:

    • 由于某种原因无法正常工作。我创建了这个文件夹:'workspace-sts-3.6.0.M1\BookingSoftware2\src\main\resources\static' 并在其中放置了一个名为 test.html 的简单 html 文件。然后我尝试:'localhost:8080/test.html' 并收到此错误:'出现意外错误(类型 = 未找到,状态 = 404)。'
    • 我想通了!它不在静态文件夹中。对我来说, src/main/webapp 文件夹成功了。您的回答使我得出了这个结论,所以我非常感谢您的帮助!
    猜你喜欢
    • 2023-04-10
    • 2019-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 2019-01-17
    • 2017-11-19
    • 2018-01-16
    相关资源
    最近更新 更多