天天看點

Idea SpringBoot項目熱部署、熱更新

文章目錄

使用Idea 開發SpringBoot項目, 修改完代碼以後,要重新啟動 Application 才可以看到效果。這樣做開發效率肯定是大受影響的。可以通過熱部署、熱更新來實時加載更改,提高效率。

添加熱部署插件的依賴:

<!--熱部署插件-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>         <!--這個設定為true熱部署才會生效-->
        </dependency>
      

Idea需要進行兩處的配置。

File

-->

Settings…

–>

Build,Excution,Deployment

Compiler

,選中

Build project automatically

Idea SpringBoot項目熱部署、熱更新
Idea SpringBoot項目熱部署、熱更新

Ctrl+Shift+A

->搜尋

registry

,找到

Registry...

,(注意是後面有三個點),然後找到

compiler.automake.allow.when.app.running

,勾選即可:

Idea SpringBoot項目熱部署、熱更新
Idea SpringBoot項目熱部署、熱更新