你要足够努力,才能够游刃有余
热部署devtools
前言
springcloud项目中有时候模块过多,对其中代码的修改需要频繁的手动对项目的进行重启,比较麻烦。引入热部署能够实现现项目的自动重启。
1.父项目
在pom.xml文件中引入插件:
<build>
<plugins>
<!--插件-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
2.子项目
在pom.xml文件中添加依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
3.开启自动编译
根据图上找到路径,对这几个选项进行勾选
4.热注册开启,更新值
按住 Ctrl+Shift+Alt+/ 四个按键
弹出窗口,选择第一项Registry
如图示对两个选项选中打勾
最后对项目进行重启
项目后面出现[devtools],热部署成功。