【问题标题】:Thymeleaf cache set to false not workingThymeleaf 缓存设置为 false 不起作用
【发布时间】:2017-05-13 14:23:35
【问题描述】:

我正在开发一个 Spring 应用程序。 项目配置如下:

  • spring-dev-tools 依赖是 maven 依赖之一
  • 通过spring-boot-starter添加thymeleaf依赖,即org.springframework.boot:spring-boot-starter-thymeleaf
  • 我已使用spring.thymeleaf.cache=false 明确禁用模板缓存
  • src/main/resources 文件夹在我的 IntelliJ IDEA 项目中被标记为资源。

我正在使用 IntelliJ IDEA 项目来运行应用程序。 当我运行应用程序时,我可以在控制台输出中看到:LiveReload server is running on port 35729
虽然看起来我的所有配置都是正确的,但正在运行的应用程序并没有加载我在运行时对模板所做的任何更改。

【问题讨论】:

    标签: spring spring-boot thymeleaf


    【解决方案1】:

    LiveReload 服务器仅在修改类路径上的文件之一Spring Doc 时加载任何更改。
    虽然我有资源,包含模板文件夹的文件夹,在类路径上,对模板文件夹中 html 文件的更改不会反映在正在运行的应用程序中。
    对我有用的是将src/main/resources/templates 添加到类路径中,即在 IntelliJ 中标记为资源

    谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-11
      • 2011-09-04
      • 2016-07-10
      • 2013-04-23
      • 2013-04-22
      • 1970-01-01
      • 1970-01-01
      • 2015-12-21
      相关资源
      最近更新 更多