本文作者:PlenKuing 转载自简书:https://www.jianshu.com/p/8475553fbc43
热部署的作用
springboot每次修改之后都需要重新启动才会生效,启动热部署之后每次修改会自动重启,而不用手动重启,提高开发效率。
1.添加依赖
<!-- SpringBoot热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
2.添加插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--没有配置该选项devtools不起作用,即应用不会restart-->
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
3.设置application.properties
spring.devtools.restart.enabled=true
4.开启自动编译
- Ctrl+Alt+S打开配置
-
设置自动编译
设置
-
Ctrl+Shift+Alt+? 选择Registry
Maintenance
-
找到选项打勾