SpringBoot hot deployment: We all know that in the project development process, often change the page data or modify the data structure, in order to show changes in effect, often need to restart the application to see the effect of changing, in fact, re-compiled the new Class file, this file recording information corresponding to a variety of codes and the like, and then Class file is loaded ClassLoader virtual machine.
The hot deployment took advantage of this feature, if it listens to the Class file changes, it will create a new ClaassLoader loading the file, through a series of process, the final result will be presented in front of us. In fact, plainly hot deployment is that you can change the front page, without restarting the server.
Action:
lead pack!
<!-- 热部署模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>
In fact, it is one step to get it;
if not, then we would do the following
1, if we find no effect of hot deployment, you need to check IDE configuration, there is no open automatically compiled.
2, if Thymeleaf template engine, template requires the default cache is set to false
#禁止thymeleaf缓存(建议:开发环境设置为false,生成环境设置为true)
spring.thymeleaf.cache=false