步驟如下:
1. 項目添加依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
2. 項目插件配置
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
3. IDEA配置修改
- Preference --> Build/Execution Deployment --> Compiler
勾選
Display notification on build completion
Build project automatically
Compile independent modules in parallel
- 快捷鍵 Option + Shift + Command + /
選擇registry
勾選 compiler.automake.allow.when.app.running