手动热部署
热部署是指在不停止应用程序的情况下更新应用程序的功能。这样可以避免短暂的服务中断,并且可以更快地部署新的功能和修复问题。热部署通常适用于Web应用程序和服务器端应用程序。
在pom.xml中添加依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
激活热部署:Ctrl+F9

自动热部署
点击文件,点击设置

点击自动构建项目并应用:


勾选。
自定义不参与重启排除项
在yml文件里设置:
devtools:
restart:
exclude: 目录/目录 /目录
热部署只在开发环境有效。
关闭热部署
设置高优先级禁用热部署:
public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled","false");
SpringApplication.run(SSMPApplication.class, args);
}
其他
在 IntelliJ IDEA 中设置热部署可以在运行应用程序时自动重新加载代码更改。要设置热部署,请执行以下步骤:
-
打开 IntelliJ IDEA,打开需要热部署的项目。
-
打开 "Run" 面板,点击 "Edit Configurations" 按钮。
-
在 "Run/Debug Configurations" 窗口中,找到你的应用程序的配置,并单击 "Reload classes after compilation" 选项。
-
点击 "Apply" 按钮,然后点击 "OK" 按钮关闭窗口。
-
在 Run 面板中运行应用程序, 现在修改的代码将会自动重新加载。
如果你使用的是Spring boot, 可以在application.properties中加入:
spring.devtools.livereload.enabled=true



















![[创业之路-48] :动态股权机制 -3- 静态股权分配 VS 动态股权分配](https://img-blog.csdnimg.cn/img_convert/f25e6264d8204bcd4951ef85692c204f.jpeg)