直接上步骤:
- 1.添加devtools jar包到工程
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
- 1
- 2
- 3
- 4
- 5
- 6
- 2.添加plugin到pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 3.开启自动编译选项
- 4.注册开启
Ctrl+Shift+Alt+/ 选择Registry
- 5.重启IDEA,启动项目,当修改Java代码IDEA就会自动进行编译了。