Intellij IDEA實現springboot熱部署過程解析
對于springboot熱部署貌似是這樣的,首先要設置idea相關配置
導航欄 File -> Settings -> Build,Execution,Deployment -> Compiler 選擇Build project automatically 打勾 如下圖所示
接著Ctrl+Shift+Alt+/ 快捷鍵選擇Registry會彈出如下圖
在紅色選擇的一行打勾,就完成了這步驟。
接著開始配置pom.xml文件
<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)
#THYMELEAF spring: thymeleaf: cache: false #這里一定要設置false prefix: classpath:/thymeleaf/ suffix: .html mode: HTML5 encoding: UTF-8 devtools:restart:#熱部署生效trueenabled: true #設置重啟的目錄 additional-paths: resources/**,static/**,templates/**#該目錄下的內容修改不重啟 exclude: data/**
配置完之后,基本上就可以運行了,還有最后要記得瀏覽器要設置 禁止緩存
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。
相關文章: