1.pom.xml
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency>
2.application.yml
spring: devtools: restart: enabled: true additional-paths: src/main/java
3.File -> Settings -> Compiler -> Build project automatically
4. 打开registry ctrl + alt +shift + /
compiler.automake.allow.when.app.running
5. restart idea.