springboot项目IDEA修改文件无需重启的方法

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

springboot项目IDEA修改文件无需重启的方法

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

springboot项目IDEA修改文件无需重启的方法

springboot项目IDEA修改文件无需重启的方法

3. pom.xml加上依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>