【发布时间】:2016-05-05 01:12:59
【问题描述】:
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>
有人可以帮我解决这个问题吗?
【问题讨论】:
标签: spring maven spring-boot