Preferences → Build, Execute, Deployment → Compiler → [x] Build project automatically
Command + Shift + A (on MacOS) → Type "Registry" → [x] compiler.automake.allow.when.app.running
Add dependency to pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.5.0</version>
<optional>true</optional>
</dependency>