SpringBoot热部署

217 阅读1分钟

SpringBoot开启热部署

热部署方式:Spring-boot-devtools工具+IDEA配置

1.在IDEA中Setting设置,开启IDEA自动构建选项

image.png

2.在Registry中勾选 Compile autoMake allow when app running

window快捷键 : ctrl + alt + shift + /

image.png

image.png

注意

Compile autoMake allow when app running这个选项在IntelliJ IDEA 2021.2之后的版本迁移到高级设置中,如下图:

image.png

3.配置项目为 更新class和resources

image.png

4.导入spring-boot-devtools坐标

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <version>2.4.5</version>
</dependency>

5.在service模块 application.yml 文件中开启热部署配置

#springdevtools
spring.devtools.restart.enabled=true