Intellij idea springboot 项目如何启动热加载

我在 Intellij idea 上开发 springboot 项目,因为需要对后台代码频繁修改,为了看到效果,我需要重启编译跑项目,才能验证代码,效率很低,有什么热加载的办法吗?

1 个解决方案

AllenJiang
中间件研发,关注微信公众号 : 小哈学Java, 回复"666", 即可免费领取10G学习&面试资料

1.首先你需要在 pom.xml 文件中添加依赖:

<!-- SpringBoot自带热加载开发工具 -->
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-devtools</artifactId>
	<scope>runtime</scope>
</dependency>

2.依赖下载完成后,你需要在 settings -> build, execution, deployment -> compiler 中勾选上 build project autometically 选项

3.确定后,按住快捷键 shift + option + command + /

Note: windows 对应的快捷键 shift + alt + control + /

勾选红框标注的那一栏,确定后,重启 idea, 就可以热加载 springboot 项目了