热部署
热部署:代码经过改动能自动部署启动,不需要程序员手动关闭重启就叫热部署
开启热部署
添加依赖到项目里
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
添加插件到pom.xml文件里(微服务项目就需要添加到总工程(父级)项目的pom.xml文件里)
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.2.RELEASE</version>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
开启自动编译的权限
更改IDEA配置
快捷键:
注意:IDEA 2022 与 IDEA 2023 配置热部署没有compiler.automake.allow.when.app.running,则在setting设置