IDEA 中配置 Jrebel
1、打开IDEA Preferences 界面,Compiler—> 勾选 Build project automatically。

2、按组合键 Shift+Ctrl+Alt+/,填入 Registry,点击 Registry。

勾选上文本框 compiler.automake.allow.when.app.running

使用Jrebel 运行SpringBoot项目
1、创建 SpringBoot 项目,启动类文件 右击用 Rebel Run ‘DemoApplication’ 运行。

2、验证 Jrebel 热部署
添加 DemoController 控制类
@RestController
public class DemoController {
@GetMapping("test")
public String test(){
return "hello world!";
}
}
访问 http://localhost:8081/test ,输出:hello world!
添加一个新方法,保存之后,不用重启项目。稍等一会,控制台输出更改的文件。

访问 http://localhost:8081/test1 ,输出 :hello,java!,热部署成功。
本文介绍了如何在IDEA中配置Jrebel以实现SpringBoot项目的热部署,无需重启即可生效。步骤包括开启自动编译设置,启用Registry中的相关选项,以及通过RebelRun启动应用。通过示例展示了Jrebel的热部署效果,添加新方法后,控制台会显示变更文件,且无需重启即可访问到新接口。
6866

被折叠的 条评论
为什么被折叠?



