SpringBoot通过配置devtools实现热部署(IntelliJ IDEA)
基于Maven的SpringBoot项目,可以通过配置spring-boot-devtools模块来使Spring Boot应用支持热部署,无需每次更改代码都要手动项目,从而提高开发者的开发效。
1、在项目中引用spring-boot-devtools
2、对spring-boot-maven-plugin进行配置
3、修改Intellij IEDA设置
File->Setting->Build,…->Compiler 将右侧 Build project automatically 勾选上
在Intellij IEDA中使用 Ctrl + Shift + a 快捷键搜索 Registry 选择搜索出来的第一个
找到 compiler.automake.allow.when.app.running ,将此项勾选上
此时重启项目,即可实现热部署,改动任意代码就会立即生效,无需重新启动。