关于springboot:SpringBoot-在IDEA中实现热部署步骤

6次阅读

共计 663 个字符,预计需要花费 2 分钟才能阅读完成。

一、开启 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。

正文完
 0