1. 程式人生 > >spring-boot-devtools在Idea中熱部署方法

spring-boot-devtools在Idea中熱部署方法

maven cache too wid onf ram 組合 ng- app

一、概述

spring boob 項目在開發中修改了項目文件不能進行熱部署,著實影響效率。

二、熱部署配置

2.1 POM文件

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <!--fork :  如果沒有該項配置,devtools不會起作用,即應用不會restart -->
        <fork>true
</fork> </configuration> </plugin>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
    <scope>true</scope>
</dependency>

2.2 idea 配置

  1. “File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,選中打勾 “Build project automatically” 。
  2. 組合鍵:“Shift+Ctrl+Alt+/” ,選擇 “Registry” ,選中打勾 “compiler.automake.allow.when.app.running” 。

技術分享

技術分享

2.3 緩存配置

1. application.properties

spring.thymeleaf.cache=false

2. Chrome禁用緩存

技術分享

spring-boot-devtools在Idea中熱部署方法