【问题标题】:Using Spring Boot 1.3, spring-boot-devtools and Thymeleaf templates won't do live reload when changed in IntelliJ 15使用 Spring Boot 1.3,spring-boot-devtools 和 Thymeleaf 模板在 IntelliJ 15 中更改时不会进行实时重新加载
【发布时间】: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


    【解决方案1】:

    您确定您正在编译您的项目吗?我知道我需要在启动 1.2.x 中这样做。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-11
      • 2018-08-29
      • 1970-01-01
      • 2020-03-14
      • 2016-01-26
      • 2016-06-24
      • 1970-01-01
      • 2019-10-31
      相关资源
      最近更新 更多