SpringBoot开发模式自动重启热部署spring-boot-devtools

    技术2025-04-24  11

    热部署

    1、页面热部署 application.properties文件中配置

    spring.thymeleaf.cache=false

    2、类文件热部署

    spring-boot-devtools

    1、添加依赖

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>

    2、修改配置application.yml

    spring: devtools: restart: enabled: true

    3、将项目设置为自动加载

    1、打开设置 勾选 Build project automatically 2、打开 Maintenance 选择 1.Register

    快捷键 (一起按下四个按键)

    windows: Ctrl + Shift +Alt + /

    Mac : command + shift + option + / 3、勾选 compiler.automake.allow.when.app.running IDEA过一会就会响应变化重启服务,如果想要快速触发,就重新编译

    参考 SpringBoot热部署自动重启 spring-boot-devtools

    Processed: 0.010, SQL: 9