gpt4 book ai didi

spring - 使用 Spring Boot 1.3、spring-boot-devtools 和 Thymeleaf 模板在 IntelliJ 15 中更改时不会进行实时重新加载

转载 作者:行者123 更新时间:2023-12-05 07:51:26 24 4
gpt4 key购买 nike

Spring Boot 1.3 引入了 spring-boot-devtools 以提供与 Spring Reloaded 类似的功能,无需重新运行您的应用程序即可重新加载修改后的静态资源模板(html、js)。

我之前一直在使用 Spring Boot 1.2.7,我能够即时修改我的静态资源,而无需重新启动我的 Spring Boot 应用程序。

同一个应用程序现在没有重新加载我的静态资源。

我正在使用 IntelliJ 15.1。应用程序打包为 WAR 文件。

我的 pom.xml 中有以下依赖项(包括其他,因不相关而被排除):

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.3.2.RELEASE</version>
</plugin>
</plugins>
</build>

我尝试使用版本标记为 1.3.2.RELEASE 的 spring-boot-maven-plugin,突然更改了我的 html,保存模板时在浏览器中可以看到 js 文件。看起来至少问题是因为 spring-bot-maven-plugin。

资源我也设置好了:

<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.html</include>
<include>**/*.properties</include>
</includes>
</resource>

有人可以帮我解决这个问题吗?

最佳答案

您确定您正在编译您的项目吗?我知道我需要在引导 1.2.x 中执行此操作。

否则,我会检查这个听起来重复的帖子: Using Spring Boot 1.3, spring-boot-devtools and Thymeleaf templates won't do live reload when changed in Netbeans

关于spring - 使用 Spring Boot 1.3、spring-boot-devtools 和 Thymeleaf 模板在 IntelliJ 15 中更改时不会进行实时重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35048308/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com