1. 程式人生 > >idea 配置 SpringBoot 熱啟動詳解,和熱啟動失效解決方案

idea 配置 SpringBoot 熱啟動詳解,和熱啟動失效解決方案

auto all pid 執行 allow run 插件 設置 如果

一、idea配置springboot熱啟動方法
1、添加spring-boot-devtools的包,true必須加上。

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

2、修改spring-boot-maven-plugin插件

<plugin>

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
idea如果沒有效果的話,那麽就需要執行下面兩步操作。

二、熱啟動失效解決方案
當使用eclipse配置熱啟動時,直接添加jar和插件即可,但是使用idea時,需要自己修改一下設置。

註意:如果換一個項目,也可能熱啟動失效,是因為idea重置了默認設置,重新按照下面的步驟設置即可。

1、找到Setting---->Compiler設置(也可以快捷鍵:Ctrl+Alt+S),勾選"Build project automatically"


2、點擊快捷鍵Alt+Ctrl+shift+a+/,(如果不行,就點擊Alt+shift+a)選擇Registry,打開界面。


3、打開界面,勾選 compiler.automake.allow.when.app.running即可,如果沒有這個選項,重置一下idea即可找到。

到此,熱啟動失效已解決,可以再重啟一下idea。

idea 配置 SpringBoot 熱啟動詳解,和熱啟動失效解決方案