1、引入依赖
以gradle项目为例,在build.gradle中添加:
implementation('org.springframework.boot:spring-boot-devtools')
2、在resources目录下,新建application.yml文件,增加配置
spring:
devtools:
restart:
enabled: true
3、点击菜单栏:File,选择Settings,勾选【Build project automatically】
4、 win系统使用快捷键:Ctrl+shift+A,输入:Registry,选中后双击
5、勾选:compiler.automake.allow.when.app.running
6、重新启动springboot项目,编辑代码,使用Ctrl+S保存文件后,会自动触发Springboot服务重启。