IntelliJ IDEA 2012.2.1版本下Spring Boot Devtools失效如何解决
注:你所述的2012.2.1应为笔误,下述解决方案针对2022.2.1版本适配。
关于配置项是否移除的说明
IntelliJ IDEA 2021.2及以上版本已经移除了旧版本中需要在Registry中修改的compiler.automake.allow.when.app.running配置项,该功能已迁移到高级设置面板中,并非配置被删除。
热更新生效操作步骤
- 确认Spring Boot DevTools依赖正确引入
Maven项目pom.xml添加配置:
Gradle项目<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency>build.gradle添加配置:developmentOnly 'org.springframework.boot:spring-boot-devtools' - 开启IDE自动构建
打开路径File > Settings > Build, Execution, Deployment > Compiler,勾选 Build project automatically 选项。 - 开启运行时自动构建权限
打开路径File > Settings > Advanced Settings,在Compiler分类下勾选 Allow auto-make to start even if developed application is currently running,该配置即为旧Registry配置的替代项。 - 配置启动项更新策略
打开当前使用的Spring Boot启动配置,修改两个参数:On 'Update' action选择 Update classes and resourcesOn frame deactivation选择 Update classes and resources
保存配置后重启启动的项目即可生效。
- 检查项目本地配置
确认项目的application.properties或application.yml中没有配置spring.devtools.restart.enabled=false,同时检查spring.devtools.restart.exclude配置是否错误排除了你修改的代码路径。
内容的提问来源于stack exchange,提问作者Summit2
相关产品推荐
相关产品推荐

