首页 > 解决方案 > Spring-Boot:DevTools 不刷新文件

问题描述

我使用 STS 构建网络服务器。

我用这段代码将依赖项放在 pom.xml 中

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <version>2.0.5.RELEASE</version>
        <optional>true</optional>
        <scope>runtime</scope>
    </dependency>

当我使用 IDE(Spring Tool Suite)运行我的网络服务器时,如果浏览器上显示的“html”文件发生更改,它会自动应用更改。

但如果我将它作为独立运行('mvnw spring-boot:run')它不起作用。

我该如何解决这个问题?

目前使用 Springframework.boot 2.0.4.RELEASE

标签: javaspringspring-bootdevtools

解决方案


在 application.properties 集中:

spring.devtools.restart.exclude=

默认值是(也许你的 html 文件在这里):

spring.devtools.restart.exclude=META-INF/maven/**,META-INF/resources/**,resources/**,static/**,public/**,templates/**,**/*Test.class,**/*Tests.class,git.properties

推荐阅读