Idea spring-boot设置热部署、热启动

港控/mmm° 2021-12-11 09:03 471阅读 0赞

首先了解一下什么是热部署、热启动

热部署:动态替换你修改的class,效率会更高。

热启动:修改代码保存时会自动重新启动项目。

1、引入热加载的插件

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-devtools</artifactId>
  4. <optional>true</optional>
  5. </dependency>

2、maven插件设置

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.springframework.boot</groupId>
  5. <artifactId>spring-boot-maven-plugin</artifactId>
  6. <configuration>
  7. <fork>true</fork>
  8. </configuration>
  9. </plugin>
  10. </plugins>
  11. </build>

3、编译设置:File->Settings->Build,Execution,Deployment->Compiler:选中 Build project automatically
在这里插入图片描述
4、运行设置:ctrl+shift+a 调起搜索,输入registry,点击第一项,打开Registry编辑框,找到compiler.automake.allow.when.
app.running
在这里插入图片描述
在这里插入图片描述
搞定!

发表评论

表情:
评论列表 (有 0 条评论,471人围观)

还没有评论,来说两句吧...

相关阅读