spring boot 热部署方式:一种使用Spring loaded 实现,另一种使用spring-boot-devtools 实现
使用Spring loaded实现方式:
修改pom.xml如下:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.6.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
然后命令行进入项目目录:运行 mvn spring-boot:run 启动项目
使用spring-boot-devtools 实现热部署 只需要 在pom.xml
<!-- 热部署模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>