参考文章:SpringBoot热部署
idea配置:
- Settings——>Build,Execution,Deployment——>Compiler——>(右边视图)Build project automatically(该项打勾)
- 快捷键:Ctrl + Shift + Alt + / ——>Registry...
- compiler.automake.allow.when.app.running(该项打勾)
pom.xml配置:
- 依赖:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency>
- build 差件
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin> </plugins> </build>
启动SpringBoot ,之后修改代码,SpringBoot都会自动重启