1. 设置“File” 》 Settings 》 Build,Execution,Deplyment 》Compiler,勾选 Build project automatically

2. 使用组合键:“Shift+Ctrl+Alt+/” ,选择 “Registry” ,找到key “compiler.automake.allow.when.app.running” 并勾选(如果是通过mvn clean spring-boot:run 命令启动项目的话是不用设置这个的,但是如果是通过主类main方法启动的话是必须要设置)


3. pom.xml加上依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

本文介绍了在IDEA中使用SpringBoot项目时,如何设置实现修改代码后无需重启即可生效的步骤:1. 在Settings的Compiler选项中启用自动构建;2. 通过Registry开启'compiler.automake.allow.when.app.running';3. 添加特定的pom.xml依赖。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



