添加依赖

<!--热部署依赖,生产环境、应用被打成jar包后,自动失效-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>


添加配置文件(我没添加也可以)
配置文件中显示指定,默认值也是true,但是防止其他地方修改了默认值,所以,建议添加这个配置信息。

spring:
  devtools:
    restart:
      enabled: true


修改mac上的Intellij IDEA配置文件
第一、修改Compiler

mac上快捷键:Command + ,

Mac上Intellij IDEA使用spring-boot热部署
第二、修改Registry

mac上快捷键:Command + Shift + A

我在preference中搜索这个没找到,用这个快捷键

Mac上Intellij IDEA使用spring-boot热部署

勾选自动编译选项

Mac上Intellij IDEA使用spring-boot热部署
总结
重启启动应用服务后,对代码进行编辑,然后保存代码,将会触发自动编译过程。如果Intellij IDEA设置了自动保存,那么每当你的代码触发了自动保存功能,将会重启应用服务。如果没有设置自动保存功能,使用Command + s 保存文件,将会触发应用重启。
--------------------- 
原文:https://blog.csdn.net/hzwy23/article/details/79925365 

相关文章:

  • 2022-12-23
  • 2022-01-09
  • 2022-01-12
  • 2021-07-22
  • 2022-01-04
  • 2021-06-13
  • 2021-06-24
猜你喜欢
  • 2021-11-26
  • 2021-04-15
  • 2021-11-27
  • 2021-11-25
  • 2022-02-23
  • 2021-08-19
相关资源
相似解决方案