springboot热部署

工具:Idea 2017

jar包:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-devtools</artifactId>
   <!-- optional=true, 依赖不会传递, 该项目依赖devtools; 
      之后依赖boot项目的项目如果想要使用devtools, 需要重新引入 -->
   <optional>true</optional>
</dependency>

application.properties(.yml)配置:

#热部署生效
spring.devtools.restart.enabled=true
#设置重启的目录,添加那个目录的文件需要restart
spring.devtools.restart.additional-paths=src/main/java
#关闭缓存, 即时刷新(按照模版来选择自己使用的模版)
#spring.freemarker.cache=false
#spring.thymeleaf.cache=true
#排除那个目录的文件不需要restart(一下两种配置根据自己的需求选择添加)
#spring.devtools.restart.exclude=static/**,public/**
#classpath目录下的WEB-INF文件夹内容修改不重启
#spring.devtools.restart.exclude=WEB-INF/**

如果出现热部署成功、但前台不刷新的问题,就要注意使用的工具是不是idea,如果是,请看↓↓↓,看图修改。


如果上图没找到:

2、组合键:Shift+ALT+Ctrl+/ ,选择“Registry”,回车,找到“complier.automake.allow.when.app.running” 

猜你喜欢

转载自blog.csdn.net/qq_37185081/article/details/80081294