Springboot 更新静态文件和热部署

1. 关闭 thymeleaf 缓存

在 application.properties 或者 application.yml 中设置

spring.thymeleaf.cache=false

2. 引入热部署包

        <!-- 热部署 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <scope>true</scope>
        </dependency>

需要进行下面的设置

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!-- fork: 如果没有该项配置, 肯定 devtools 不会起作用, 即应用不会 restart -->
                    <fork>true</fork>
                </configuration>
            </plugin>

在 application.properties 或者 application.yml 中设置

# 热部署生效
devtools.restart.enabled=true
#设置重启的目录
devtools.restart.additional-paths=resources/**,static/**,templates/**
#该目录下的内容修改不重启
devtools.restart.exclude=data/**

配置文件发黄警告:
https://blog.csdn.net/YKenan/article/details/105933314

3. 修改设置

3.1

在这里插入图片描述

3.2

Ctrl+Shift+Alt+/

在这里插入图片描述

在这里插入图片描述

3.3

在这里插入图片描述

参考网址:
[1]: https://www.cnblogs.com/blog5277/p/9271882.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值