工具为eclipse。
修改pom.xml文件:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>true</scope>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
</plugin>
</plugins>
</build>
修改完pom文件以后,在yml配置文件里增加以下内容:
spring:
devtools:
restart:
enabled: true
true为开启热部署,false为关闭热部署。