idea开发springboot项目时的自动编译和热部署

1.最好将idea的启动器设置一下

idea开发springboot项目时的自动编译和热部署

2.开启自动编译
file > settings > Build,Execution,Deployment > Compiler
勾选 Build project automatically

idea开发springboot项目时的自动编译和热部署

3.Crtl+Alt+Shift+/ 勾选 compiler.automake.allow.when.app.running

idea开发springboot项目时的自动编译和热部署

本人前两步这样设置之后就ok了,如果不行再往下看
4、在dependencies 下添加 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency>

5、在build > plugins > plugin 下添加 <configuration> <fork>true</fork> </configuration> 第四步有没有用我也没有试出来效果,添加第三步就会有效果了,但是这种设置会重启整个项目,可以放弃这种方式(和手动重启项目差不多)