IDEA实现热部署三种方式
一、IDEA自带
(只在debug模式下,并且idea失去焦点才会触发热加载,加载速度慢)
步骤:顶部菜单 >> Edit Configurations >> SpringBoot >> 选中当前项目名 >> 选择相应热更新
二、使用devtools依赖插件
(项目十分臃肿时,热启动会很慢,影响开发效率)
1. 开启静态编译
步骤:File -> Settings -> Default Settings -> Build -> Compiler 然后勾选 Build project automatically
2. 开启动态编译
步骤:按住Ctrl + Shift + Alt + / 进入Registry
- compiler.automake.allow.when.app.running >> 自动编译
- compile.document.save.trigger.delay >> 静态文件自动编译时间
- compiler.automake.trigger.delay >> 自动编译时间
3. 开启IDEA的热部署策略
步骤:顶部菜单 >> Edit Configurations >> SpringBoot >> 选中当前项目名 >> 选择相应热更新
4. pom导入依赖(其余步骤和前面相同)
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
三、使用JRebel 插件
1. 安装插件并激活,激活方法网上有很多,这里就不一一叙述,建议支持正版。
2. 开启自动编译
(这里和开头的1,2步骤一样)
3. JRebel 配置
4. 完成
启动用插件提供的方式启动