1、pom.xml配置
<!-- 热加载-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<!--<scope>true</scope>-->
</dependency>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<!-- 如果没有该配置,热部署的devtools不生效 -->
</configuration>
</plugin>
2、更改配置文件
#热部署生效
spring.devtools.restart.enabled=true
#设置重启的目录,检索目录(resources/static、resources/templates) spring.devtools.restart.additional-paths= src/main/java
#classpath目录下的WEB-INF文件夹内容修改不重启
#spring.devtools.restart.exclude= WEB-INF/**
3、File->setting-》build-》compiler-》build project auto勾选
4、shift+ctrl+alt+/ 快捷键 点击Registry 选中 compiler auto
貌似第5、6步不需要。。。
5、热部署jar包
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork><!-- 如果没有该配置,热部署的devtools不生效 -->
</configuration>
<dependencies>
<!-- spring热部署 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>2.0.4.RELEASE</version>
</dependency>
</dependencies>
</plugin>
6、运行:mvn clean spring-boot:run
不行就重启吧