环境
IDEA 2020.3
JDK 8
spring boot 2.3.7
依赖
在创建项目时选 Spring Boot DevTools
或者在xml手动加依赖
<dependencies>
.....
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
.....
</dependencies>
devtools 配置
项目创建好后先配置这个devtools
用这个东西可以热更新代码,开发项目不用频繁重启
我用的是IDEA2020.3 参考的配置方案是来自这里
[解决IDEA下SpringBoot devtools热启动热部署、修改html或js代码还要重新启动服务问题] (https://blog.csdn.net/u012374381/article/details/92838633)
第1步
第2步
第3步
在idea里面 按下 ctrl + shift + alt + / 然后选 Registry
第4步
附加技巧
有时候在创建好项目后又想再添加一些 idea创建springboot项目时提供的那些starter依赖支持,可是又不想手写pom.xml
可以 file->settings->plugins那里添加一个叫Edit Starters的插件(安装插件后需要重启),
然后在pom.xml里面 右键,点 Generate -> Edit Starters 弹出来的框搜索要加的东西,双击要加的东西才会添加进右边