【黑马程序员SpringBoot2全套视频教程,springboot零基础到项目实战(spring boot2完整版)】
首先明确一个事情,热部署这个东西,只在我们的开发环境中有效,上线后就没用了【这也符合道理】
在配置文件中关闭热部署
就是这个属性了,设置成false 试试
当我删除了两行打印时,确实没有进行热部署了
但是用配置文件做这个设置,有一个痛点,很有可能这个配置文件设置热部署关闭了,但是另外一个优先级更高的配置文件把热部署打开了,那结果就还是打开了【痛点!】
【回顾属性加载优先顺序】
https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config
其实这里面比配置文件优先级高的多了去了,直接用一个
当程序启动之前,加一个设定
package com.dingjiaxiong;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class Springboot12HotDeployApplication {public static void main(String[] args) {System.setProperty("spring.devtools.restart.enabled", "false");SpringApplication.run(Springboot12HotDeployApplication.class, args);}}
现在就是真正的好关了
重启服务器,测试一下
没毛病,现在等不来热部署了
回顾一下