文章目录
方式一:idea中热部署
一、安装JRebel
1、在IDEA中一次点击 File->Settings->Plugins->Brows Repositories
2、在搜索框中输入JRebel进行搜索
3、找到JRebel for intellij
4、install
5、安装好之后需要restart IDEA
二、激活JRebel
JRebel并非免费的插件,需要激活之后才能使用。
1、首先到github上去下载一个反向代理软件,我下载的是windows x64版本
2、双击运行我们下载的程序
3、在IDEA中一次点击 File->Settings->JRebel 并找到激活界面
4、选择JRebel activated中的 connect to online licensing service
第一行输入 http://127.0.0.1:8888/自己生成的uuid
这里必须是uuid才可以通过验证
第二行输入正确的邮箱格式,例如:2936412130@qq.com
再点击以下change liense 按钮验证激活
这里的uuid需要自己生成
uuid生成网站:https://www.uuidgenerator.net/version1
5、最后别忘了把JRebel设置为offline模式 点一下work offline
三、相关设置
1.开启IDEA的自动编译(静态)
2.开启IDEA的自动编译(动态)
设置 compiler.automake.allow.when.app.running
ctrl+shift+A 或者 help->find action…打开
搜索registry
找到 compiler.automake.allow.when.app.running 并✔
方式二:自动热部署(不推荐)
1、导包
<!--热部署依赖包
该包包含开发所需的所有工具 热部署就包含在其中-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
2、开启开关
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--打开开关-->
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
3、打开自动编译
4、勾选设置:ctrl+shift+alt+/
但是上述方式比较耗电脑资源,每次修改都会触发编译,所以推荐使用手动进行热部署
手动热部署
1.导包(同上)
2.打开开关(同上)
3.点击idea右上角