首頁  >  文章  >  Java  >  詳解 Spring Boot 熱部署 Devtools

詳解 Spring Boot 熱部署 Devtools

Guanhui
Guanhui轉載
2020-07-24 17:19:332339瀏覽

詳解 Spring Boot 熱部署 Devtools

1 pom.xml檔案

#註:熱部署功能spring-boot-1.3開始有的

<!--添加依赖-->
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <!-- optional=true,依赖不会传递,该项目依赖devtools;之后依赖myboot项目的项目如果想要使用devtools,需要重新引入 -->
  <optional>true</optional>
</dependency>

附註:project 中新增spring-boot-maven-plugin,主要在eclipse中使用,idea中不需要新增此配置。


<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
        <fork>true</fork>
      </configuration>
    </plugin>
  </plugins>
</build>

2 更改idea配置

  1) “File” -> “Settings” -> “ Build,Execution,Deplyment” -> “Compiler”,選取勾選“Build project automatically” 。

  2) 組合鍵:「Shift Ctrl Alt /」 ,選擇 “Registry” ,選取打勾 “compiler.automake.allow.when.app.running” 。

3 Chrome停用快取

  F12或「Ctrl Shift I」,開啟開發者工具,「Network」 標籤下選取勾選「Disable Cache(while DevTools is open)」

推薦教學:《Java教學

以上是詳解 Spring Boot 熱部署 Devtools的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:jb51.net。如有侵權,請聯絡admin@php.cn刪除