SpringBoot实现热加载

一、通过devtools依赖

debug模式启动应用,devtools开发工具依赖可以监听到用户修改然后重启,但并不是真正意义上的热加载

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>

二、通过idea修改启动应用配置

在idea应用启动位置,点击下拉,Edit Configurations -> Modify options 勾选以下两个选项:

  • On 'Update' action -> Update classes and resources
  • On frame deactivation -> Update classes and resources

debug模式启动应用,只能够监控方法体内部的修改,但并不能修改类结构,不然会报错

三、通过JRebel and XRebel插件

设置(Set) -> 插件(Plugins) -> JRebel and XRebel(需要license进行激活)。

这时不能使用idea自带的debug启动应用,而是使用 JRebel and XRebel 插件提供的debug模式启动应用。

PS:写作不易,如要转裁,请标明转载出处。
%{ comment.page.total }条评论

猜你想看

微信小程序:前端开发宝典

最近文章
工具操作
  • 内容截图
  • 全屏
登录
注册
回顶部