springboot开启热重载HotSwap后HTML修改不生效

使用JRebel可以,但不是根本原因,问题出在使用了Thymeleaf,但Thymeleaf的缓存(cacheable)属性默认开启,需要关闭。

一种方法是在Thymeleaf的TemplateResolver中templateResolver.setCacheable(false),简单地可以在application.yml中设置:

spring:
  thymeleaf:
    cache: false 
    prefix: classpath:/templates/
    encoding: UTF-8
    suffix: .html
    mode: HTML

posted @ 2023-09-03 12:16  思所匪夷  阅读(22)  评论(0)    收藏  举报  来源