开启热部署:
1.开启IDEA的Hot Swap支持
2.在POM.xml添加Spring-boot-devtools依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
3.修改pom.xml中关于spring-maven-plugin的配置:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--fork:设置True,否则可能devtools不会起作用-->
<fork>true</fork>
</configuration>
</plugin>
使用热部署:
在修改代码以后,按ctrl+F9(windows)重新构建即可,或者ctrl+shift+F9重新编译。或者点击工具栏中的Build Project按钮: