1.在maven中添加如下配置
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
更改开发工具(idea)配置
(1)进入设置setting,Build,Execut, Deployment -> Compiler 勾选右侧的Build Project automatically
(2)开启项目运行时自动build,在打开的页面上快捷键ctrl + shift + a 搜索命令:registry –> 勾选compiler.automake.allow.when.app.running