SpringBoot通过配置devtools实现热部署
步骤:
一、在项目的pom.xml文件添加如下两段
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <addResources>true</addResources> </configuration> </plugin
2、Intellij IEDA 使用ctrl+shift+a 快捷键搜索Registry,选择搜索出来的第一个,找到compiler.automake.allow.when.app.running,勾上开启此功能即可
此时重新启动项目即可实现热部署,改动任意代码会立即生效,不用再每次重新启动项目