SpringBoot five hot deployment methods

1. Template hot deployment

        In SpringBoot, the page of the template engine is cached by default. If the content of the page is modified, the modified page will not be obtained by refreshing the page. Therefore, we can turn off the cache of the template engine in application.properties, as follows:

        Thymeleaf configuration:

spring.thymeleaf.cache=false

        FreeMarker configuration:

spring.freemarker.cache=false  

        Groovy configuration:

spring.groovy.template.cache=false

        Velocity configuration:

spring.velocity.cache=false

2. Use the debug mode Debug to achieve hot deployment

This method is the simplest and fastest hot deployment method. When running the system, use the Debug mode without installing any plug-ins. However, the configuration file and method name are not changed, and classes and methods are added for hot deployment. The scope of application is limited. (java project www.fhadmin.org)

3、spring-boot-devtools

        Add spring-boot-devtools dependency to Spring Boot project to realize hot deployment of pages and code. as follows:

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

This method is characterized by a wide range of effects. Any changes to the system including configuration file modification and method name changes can be covered, but the sequelae are also very obvious. It is realized by the strategy of restarting after file changes, mainly saving us Manually click the restart time to improve the effectiveness, and the experience is slightly worse.

spring-boot-devtools turns off template caching by default. If you use this method, you don’t need to configure it separately.

4、Spring Loaded

This method is similar to the Debug mode and has a limited scope of application, but does not depend on the startup of the Debug mode. It can be started through the Spring Loaded library file to perform real-time hot deployment in the normal mode. This needs to be configured in run confrgration.

5 、 JRebel

Jrebel is the best hot deployment tool for Java development, and it 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.


Guess you like

Origin blog.51cto.com/14622073/2553925