• Thymeleaf热部署 实现更改页面不重启


    1、修改pom文件,添加依赖

     1 <dependency>
     2    <groupId>org.springframework.boot</groupId>
     3    <artifactId>spring-boot-starter-thymeleaf</artifactId>
     4 </dependency>
     5 
     6 <dependency>
     7    <groupId>nekohtml</groupId>
     8    <artifactId>nekohtml</artifactId>
     9    <version>1.9.6.2</version>
    10 </dependency>

    说明:使用springboot的thymeleaf模板时默认会对HTML进行严格的检查,导致当你的标签没有闭合时就会通不过。nekohtml这个依赖可以解决这一问题

    2、简单配置一下:

    spring.thymeleaf.cache=false
    spring.thymeleaf.mode = LEGACYHTML5

    说明:

    第一行配置是清除缓存,实现热部署。也就是修改了html后不用重启,刷新页面就能看到效果。不过这儿特别强调一下,修改完html后一定要ctrl+f9重新build一下。再回到浏览器刷新,就能看到效果了,就这个花了我一个小时去找答案。

    第二行配置是回避HTML进行严格的检查的配置,当然你需要提前引入nekohtml依赖。

    注意:引入

    Thymeleaf

    依赖后,可以不用在application.properties里配置,默认会在resource.templates里找 。html的页面

    原地址: https://blog.csdn.net/qq_22212003/article/details/80329896

    <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    
    <dependency>
       <groupId>nekohtml</groupId>
       <artifactId>nekohtml</artifactId>
       <version>1.9.6.2</version>
    </dependency>
  • 相关阅读:
    oracle保留小数,例如0.00
    线程池读取List<T>实例
    Linq XML
    C# 反射 表达式树 模糊搜索
    MVC权限模块
    .NET-提取字符串实践总结
    2014,码农梦想,先从态度开始!
    Biztalk开发系列之二. (AS2配置)
    测试2
    Biztalk Http 适配器使用.开发系列(一)
  • 原文地址:https://www.cnblogs.com/The-second/p/12597099.html
Copyright © 2020-2023  润新知