【问题标题】:Refreshing static content with Boot使用 Boot 刷新静态内容
【发布时间】:2015-06-18 22:34:40
【问题描述】:

我使用带有 gradle 和 netbeans 的 spring boot。

我的 build.gradle 的一部分。

dependencies {
  compile("org.springframework.boot:spring-boot-starter-data-jpa")
  compile("org.springframework.boot:spring-boot-starter-jdbc")
  compile("org.springframework.boot:spring-boot-starter-web")
  runtime("mysql:mysql-connector-java")
  testCompile("org.springframework.boot:spring-boot-starter-test") 
}

在我的资源文件夹中,包含静态文件夹

css(文件夹) js(文件夹) html

TomcatEmbedded 由脚本自动启动。

当我修改 css、js 或 html 时,没有考虑更改。 我需要停止 gradle 脚本并再次运行它。

是否需要进行设置才能热交换代码?

【问题讨论】:

  • 我没有使用 netbeans 的经验,但在 eclipse 上没有太多经验。 /src/main/resources/static/* 对我来说是可重新加载的。您是否有可能在资源上设置了某种缓存控制标头并且浏览器没有获取?

标签: tomcat netbeans spring-boot


【解决方案1】:

确保使用 gradle “bootRun” 任务,而不是“run”。 bootRun 将允许重新加载。

【讨论】:

    猜你喜欢
    • 2018-02-10
    • 1970-01-01
    • 1970-01-01
    • 2021-10-16
    • 2018-02-14
    • 2012-02-10
    • 1970-01-01
    • 2018-06-26
    • 1970-01-01
    相关资源
    最近更新 更多