springboot 热部署

注意以下的热部署方式在IDEA是默认没有打开自动编译的,手动编译需要快捷键(Ctrl+Shift+F9),自动编译的修改配置如下:(注意刷新不要太快,会有1-2秒延迟)

File-Settings-Compiler-Build Project automatically 

设置以下两项(第一项如已设置直接设置第二项)

  1) “File” -> “Settings” -> “Build,Execution,Deplyment” -> “Compiler”,选中打勾 “Build project automatically” 。

  2) 组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,选中打勾 “compiler.automake.allow.when.app.running” 。

引入 spring-boot-devtools

maven中引入

在pom中直接引入依赖

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

gradle中引入

dependencies {
    compile('org.springframework.boot:spring-boot-devtools')
    }

搞定收工。

原文地址:https://www.cnblogs.com/woshuyuqiang/p/9291107.html