添加依赖
使用 Maven 构建项目,在 pom.xml 中添加 spring-boot-devtools。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<optional>true</optional>阻止依赖传递。
配置编译器
使用 ⌘ + , 打开 Preference。

配置编译器自动编译项目
如上配置后,修改 Java 类后,项目会自动 Build。
但无法在项目运行和调试时进行,所以我们还要进行下一步配置,启用该功能。
配置 IDEA
使用 ⇧ + ⌘ + A 搜索 Registry。

搜索 Registry
打开 Registry,并 ☑️ complier.automark.allow.when.app.running。

允许运行时自动构建项目