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 :

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

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

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

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

如下图所示

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

官方文档有说明:

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

/META-INF/maven, /META-INF/resources, /resources, /static, /public, /templates

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

上一篇:Ext Js Sencha Cmd 命令 打包charts


下一篇:解决linux安装软件:/lib/ld-linux.so.2: bad ELF interpreter问题