总体步骤:
- 现已有一个创建好的SpringBoot工程
- 引入热部署配置(在pom.xml文件中)
<!--热部署配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
- 进行Setting设置
“File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically”
- 进行compiler.automake.allow.when.app.running勾选
组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running”
- 重启项目将可应用
作用: 热部署可以在启动一次IDEA的情况下,自动进行编译,你不必每次都手动的去点停止和启动了。
注意: 热部署方式在IDEA是默认没有打开自动编译的,手动编译需要快捷键(Ctrl+Shift+F9),自动编译的修改配置如下:(注意刷新不要太快,会有1-2秒延迟)