IDEA(2021.2.1)配置Spring Boot热加载

在 IDEA 中设置 Spring Boot 热加载

截至当前文章,IDEA 最新版本为:2021.2.1

1、引入spring-boot-devtools

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

2、点击File》Settings》Advanced Settings,选中以下选项

注意:有些老版本的 IDEA 是在注册表中勾选改选项的,您可以按照如下步骤设置

1、快捷键:shift+ctrl+alt+/打开注册表

2、找到compiler.automake.allow.when.app.running并勾选

3、点击File》Settings》Build,选中以下选项

最后,IDEA 好像时根据文件最后更改日期来判断是否更新的,加入您连续按ctrl+s保存文件,貌似不会触发热加载~

为之则易,不为则难
原文地址:https://www.cnblogs.com/oldli/p/15267425.html