---
title: "Spring boot 热部署"
author: "yzabstract"
date: "2018-12-17T15:51:37Z"
tags: ["Spring"]
categories: ["互联网"]
slug: "spring-boot"
draft: false
lastmod: "2018-12-17T15:51:37Z"
id: 2435325
url: "https://yzabstract.iteye.com/blog/2435325"
---

\[b]开发环境的调试\[/b] 热启动在正常开发项目中已经很常见了吧，虽然平时开发web项目过程中，改动项 目启重启总是报错；但springBoot对调试支持很好，修改之后可以实时生效，需要 添加以下的配置： org.springframework.boot spring-boot-devtools true org.springframework.boot spring-boot-maven-plugin true 该模块在完整的打包环境下运行的时候会被禁用。如果你使用java -jar启动应用或 者用一个特定的classloader启动，它会认为这是一个“生产环境”。 \[b]IDEA配置\[/b] 注意以下的热部署方式在IDEA是默认没有打开自动编译的，手动编译需要快捷键（Ctrl+Shift+F9），自动编译的修改配置如下：(注意刷新不要太快，会有1-2秒延迟) File-Settings-Compiler-Build Project automatically 在pom中直接引入依赖 org.springframework.boot spring-boot-devtools true 　　设置以下两项（第一项如已设置直接设置第二项） 　　1） “File” -&gt; “Settings” -&gt; “Build,Execution,Deplyment” -&gt; “Compiler”，选中打勾 “Build project automatically” 。 　　2） 组合键：“Shift+Ctrl+Alt+/” ，选择 “Registry” ，选中打勾 “compiler.automake.allow.when.app.running” 。 　　之后直接正常run即可！