注意:這個功能只有在開發環境中使用,一旦項目上線在生產環境裏這個功能必須關閉
第一步:Adding devtools to your project(向項目中添加devtools)
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
第二步:Adding plugin to your pom.xml(在pom.xml中添加插件)
注意:將下面的內容粘貼到聚合父類總工程的pom.xml中
<build> <finalName>你自己的工程名字</finalName> //這一行可以省略 <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin> </plugins> </build>
第三步:enabling automatic build(啓用自動構建)
打開Setting,按照下圖設置並保存
第四步:update the value of(更新)
利用快捷鍵:Alt+Shift+Ctrl+/ 彈出窗口,點擊Registry... 如下圖
將如下圖部分打上勾,然後點擊Close關閉按鈕