您的位置:首页 >SpringBoot热部署启动关闭流程是什么
发布于2023-05-11 阅读(0)
扫一扫,手机访问
在SpringBoot工程的pom.xml配置文件中,添加以下依赖
<!--手工启动热部署,用到的开发者工具依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>

IDEA中激活热部署
快捷键:Ctrl + F9
图形化界面Build Project

IDEA中自动激活热部署(IDEA失去焦点五秒后自动构建项目,启动热部署)
第一步:
File 》Setting 》Build、Execution、Deployment 》Compiler 》勾选Build project automatically


第二步:
File 》Setting 》advanced Settings 》勾选Allow auto-make to start even if development application is currently running

关于热部署:
重启(Restart):自定义开发代码,包含类、页面、配置文件等,加载位置restart类加载器
重载(ReLoad):jar包,加载位置base类加载器
热部署范围配置:
默认不触发重启的目录列表:
/META-INF/maven
/META-INF/resources
/resources
/static
/public
/templates
springboot配置文件中,手动设置不参与热部署的文件或文件夹:
# 将application.yml设置为不参与热部署,若需要设置多个参数,参数之间用逗号','隔开
spring:
devtools:
restart:
exclude: application.yml
绝对保障,使用不会被配置文件的配置所覆盖的,高优先级配置,来设置热部署关闭:
SpringBoot工程启动类中配置:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootSsmpApplication {
public static void main(String[] args) {
//设置热部署关闭
System.setProperty("spring.devtools.restart.enabled","false");
SpringApplication.run(SpringbootSsmpApplication.class, args);
}
}
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
正版软件
正版软件
正版软件
正版软件
正版软件
1
2
3
7
9