一、开启IDEA的主动编译(动态)

具体步骤:关上顶部工具栏 File -> Settings -> Default Settings -> Build -> Compiler 而后勾选 Build project automatically 。

二、开启IDEA的主动编译(动静)

具体步骤:同时按住 Ctrl + Shift + Alt + / 而后进入Registry ,勾选主动编译并调整延时参数。

  1. compiler.automake.allow.when.app.running -> 主动编译
  2. compile.document.save.trigger.delay -> 自动更新文件

PS:网上极少有人提到compile.document.save.trigger.delay 它次要是针对动态文件如JS CSS的更新,将延迟时间缩小后,免编译间接按F5刷新页面就能看到成果!

三、开启IDEA的热部署策略(十分重要)

具体步骤:顶部菜单- >Edit Configurations->SpringBoot插件->指标我的项目->勾选热更新。

四、在我的项目增加热部署插件

具体步骤:在POM文件增加热部署插件

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-devtools</artifactId>

<scope>runtime</scope>

</dependency>

五、敞开浏览器缓存(重要)

关上谷歌浏览器,关上F12的Network选项栏,而后勾选【✅】Disable cache 。