• 1. Hot template deployment
  • 2. Use the Debug mode to implement hot deployment
  • 3, spring – the boot – devtools
  • Four, Spring the Loaded
  • 5、JRebel

1. Hot template deployment


In Spring Boot, caching is enabled for template engine pages by default. If the content of the page is modified, refreshing the page will not get the modified page. Therefore, we can disable caching for template engine in application.

Thymeleaf configuration:

spring.thymeleaf.cache=false
Copy the code

FreeMarker’s configuration:

spring.freemarker.cache=false
Copy the code

Groovy configuration:

spring.groovy.template.cache=false
Copy the code

Velocity configuration:

spring.velocity.cache=false
Copy the code

2. Use the Debug mode to implement hot deployment


This mode is the simplest and fastest hot deployment mode. When running the system, use the Debug mode without installing any plug-ins. However, the configuration file is not sent, the method name is changed, and classes and methods are added for hot deployment.

3, spring – the boot – devtools


Hot deployment of pages and code can be achieved by adding spring-boot-DevTools dependencies to the Spring Boot project.

As follows:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
</dependency>
Copy the code

This way is characteristic of wide scope, any changes including profile modification system, the method can cover the name change, but the aftermath is also very obvious, it is to use the file after the restart strategy to implement the change, mainly saved we manually click restart time, improve the effectiveness of the experience would be a bit poor.

Spring-boot-devtools turns template caching off by default. If you use this method, you do not need to configure to turn off template caching separately.

Four, Spring the Loaded


This mode is similar to the Debug mode in that its application scope is limited, but it does not rely on the Debug mode to start. You can use the Spring Loaded library file to start real-time hot deployment in normal mode. This configuration needs to be configured in run Confrgration.

5、JRebel


Jrebel is the best hot deployment tool for Java development and provides excellent support for Spring Boot. Jrebel is a paid software with a 14-day trial period. , can be installed directly through the plug-in.