加入依赖:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
yml文件设置:
生产环境设置为false
spring: devtools: restart: enabled: true
IDEA设置:
当我们修改了java类后,IDEA默认是不自动编译的,而spring-boot-devtools又是监测classpath下的文件发生变化才会重启应用,所以需要设置IDEA的自动编译:
(1)File-Settings-Compiler-Build Project automatically
(2)ctrl + shift + alt + /,选择Registry,勾上 Compiler autoMake allow when app running
更多推荐
Spring Boot(三):工具(1)——spring-boot-devtools
发布评论