Intellij IDEA 實現springboot熱部署

對於springboot熱部署貌似是這樣的,首先要設置idea相關配置html

導航欄 File -> Settings -> Build,Execution,Deployment -> Compiler 選擇Build project automatically 打勾 以下圖所示spring

接着 Ctrl+Shift+Alt+/ 快捷鍵選擇Registry會彈出以下圖瀏覽器

在紅色選擇的一行打勾,就完成了這步驟。緩存

接着開始配置pom.xml文件springboot

.....
<
dependencies>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>
</
dependencies>
<build>
<plugins>
<!-- springboot maven plugin -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--fork : 若是沒有該項配置,確定devtools不會起做用,即應用不會restart -->
<fork>true</fork>
</configuration>
</plugin>
</plugins>

</build>
 

pom文件也配置好了,就開始配置application.yml (或者 application.properties)app

   #THYMELEAF
 spring:
    thymeleaf:
      cache: false #這裏必定要設置false 
      prefix: classpath:/thymeleaf/
      suffix: .html
      mode: HTML5
      encoding: UTF-8
devtools:
    restart:
      #熱部署生效true
      enabled: true
   #設置重啓的目錄
   additional-paths: resources/**,static/**,templates/**
      #該目錄下的內容修改不重啓
  exclude: data/**

配置完以後,基本上就能夠運行了,還有最後要記得瀏覽器要設置 禁止緩存maven

 

以上就是springboot熱部署的流程,但願對你們有所幫助!ide

相關文章
相關標籤/搜索