- 添加插件
<!-- 热部署模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个网上说需要设置为 true 热部署才有效,实测没有也可以的 -->
</dependency>
- idea的设置
Preferences > Build, Execution, Deployment > Compiler
勾选Build project automatically
然后
Shift+Ctrl+Alt+/(Mac是Cmd+Shift+A)
搜索registry
勾选 compiler.automake.allow.when.app.running
小结
网上的教程很多都忽略了idea的设置,导致热部署不生效