IntelliJ IDEA配置Springboot2.x 通过devtools实现代码热部署,提高调试效率

1、pom.xml添加依赖:

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

2、菜单File > Settings > Complier > 选中 Build project automatically :
在这里插入图片描述

3、使用该组合键 Shift+ALT+Ctrl+/ ,选择 Registry ,然后:

勾选complier.automake.allow.when.app.running

设置compiler.automake.postpone.when.idle.less.than 延时热部署时间为500(单位是毫秒),也就是保存后500毫秒内触发代码热部署。

如下图所示
在这里插入图片描述
官方文档有说明:
在这里插入图片描述

/META-INF/maven, /META-INF/resources, /resources, /static, /public, /templates
默认情况下,这些文件资源不会自动重新加载,但是我们可以通过 spring.devtools.restart.exclude 属性进行配置从而排除某些文件。

原文地址:https://www.cnblogs.com/xiaocy66/p/10589268.html