关于springboot程序的热部署主要是使用Devtool来实现的
要实现springboot热部署首先需要在idea开启相关配置
开启idea 自动makae 功能
1、CTRL + SHIFT + A –> 查找make project automatically –> 选中
2、CTRL + SHIFT + A –> 查找Registry –> 找到并勾选compiler.automake.allow.when.app.running
在pom文件中添加devtool依赖包
<!--spring boot devtools依赖包-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
<!--构建节点-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin </artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
这里要说的是,使用上面的热部署方式,其实根本上还是在更改代码成功后,重新运行项目,所以,如果有有兴趣可以去看看JRebel热部署工具吗,这个工具会让你开发更加便捷