添加依賴
使用 Maven 構(gòu)建項(xiàng)目,在 pom.xml 中添加 spring-boot-devtools。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<optional>true</optional>阻止依賴傳遞。
配置編譯器
使用 ? + , 打開 Preference。

配置編譯器自動(dòng)編譯項(xiàng)目
如上配置后,修改 Java 類后,項(xiàng)目會(huì)自動(dòng) Build。
但無法在項(xiàng)目運(yùn)行和調(diào)試時(shí)進(jìn)行,所以我們還要進(jìn)行下一步配置,啟用該功能。
配置 IDEA
使用 ? + ? + A 搜索 Registry。

搜索 Registry
打開 Registry,并 ?? complier.automark.allow.when.app.running。

允許運(yùn)行時(shí)自動(dòng)構(gòu)建項(xiàng)目