尧图精选

devtool热部署

🕒 发布时间:2026/10/1 22:06:42 📁 来源:尧图网络
方案一:使用 Spring 官方热部署(首选,免费)直接使用 Spring 官方提供的 Spring Boot DevTools。应该用哪个版本: 必须使用与你项目 Spring Boot 完全一致的版本。引入方式: 如果你是 Maven 项目,直接在 pom.xml 中引入(无需手动写死版本号,它会自动继承父版本):dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-devtools/artifactIdoptionaltrue/optional !-- 避免把热部署打包到生产环境 --/dependency🛠️ 配合 IDEA 2020.1 必须要做的双重配置:由于 IDEA 默认不会在后台自动编译,引入 DevTools 后你必须在 IDEA 2020.1 中开启以下两个隐藏开关:开启自动构建: 点击 File - Settings - Build, Execution, Deployment - Compiler,勾选 Build project automatically。开启运行时热部署:在 IDEA 2020.1 中,按下快捷键 Ctrl + Shift + Alt + /(Mac 为 Cmd + Option + Shift + /),选择 Registry...。找到并勾选 compiler.automake.allow.when.app.running。注意:配置完成后,必须重启 IDEA 才会生效。在 Maven 的 pom.xml 中,l
上一篇/下一篇内容由系统自动关联 返回资讯列表 →