1、在pom.xml导入热部署依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
2、在application.properties中添加
#热部署生效
spring.devtools.restart.enabled=true
#设置重启目录
spring.devtools.restart.additional-paths=src/main/java
#设置cLasspath月录下的WEB-INF文件夹内容修改后不重启
spring.devtools.restart.exclude=static/**
3、idea要完成一下设置后才会生效,eclipse不需要设置。
①打开Settings页面,在左边的菜单栏依次找到Build,Execution,DeploymentCompile,勾选Build project automatically
②按Ctrl+Shift+Alt+/快捷键调出Maintenance页面,单击Registry,勾选compiler.automake.allow.when.app.running复选框