您的位置首页百科问答

SpringBoot通过配置devtools实现热部署

SpringBoot通过配置devtools实现热部署

的有关信息介绍如下:

SpringBoot通过配置devtools实现热部署

基于Maven的SpringBoot项目,通过配置spring-boot-devtools模块来使Spring Boot应用支持热部署,无需每次更改代码都要手动项目,提高开发者的开发效率

在项目的pom.xml文件添加如下两段

org.springframework.boot

spring-boot-devtools

1.5.7.RELEASE

true

org.springframework.boot

spring-boot-maven-plugin

true<欠言/fork>

true

如果使用的是Intellij IEDA开发工具,还需要到设置里将project automatically勾选上;File->Setting->Build,…->Compiler 将右侧project automatically勾上

Intellij IEDA 使用ctrl+shift+a快捷键搜包膨索处宙露Registry,选择搜索出来的第一个

找到compiler.automake.allow.when.app.running,勾上开启此功能即可

此时重新启动项目即可实现热部署,改动任意代码会立即生效,不用再每次重新启动项目