Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the five hot deployment modes of Spring Boot?

Shulou Source: shulou.com Published: 2022-05-31 22:47:16 10月03日 Update

This article introduces you what are the five hot deployment ways of Spring Boot, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1. Hot deployment of templates

In Spring Boot, the page caching of template engine is enabled by default. If you modify the content of the page, you will not get the modified page if you refresh the page, so we can turn off the caching of template engine in application.properties, as follows:

Configuration of Thymeleaf:

Spring.thymeleaf.cache=false

Configuration of FreeMarker:

Spring.freemarker.cache=false

Configuration of Groovy:

Spring.groovy.template.cache=false

Configuration of Velocity:

Spring.velocity.cache=false

2. Use debug mode Debug to achieve hot deployment

This method is the simplest and fastest hot deployment mode, running the system using Debug mode, without any plug-ins, but no configuration files, method name change, add classes and methods for hot deployment, the scope of use is limited.

3 、 spring-boot-devtools

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

As follows:

Org.springframework.boot

Spring-boot-devtools

This method is characterized by a wide range of functions, and any changes in the system, including the modification of the configuration file and the change of the method name, can be covered, but the sequelae are also very obvious. it is realized by using the strategy of restarting after the file is changed. it mainly saves us the time of manual click restart, improves the effectiveness, and will be slightly worse in the experience.

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 Debug mode, with limited scope of application, but does not rely on Debug mode startup, starting through the Spring Loaded library file, you can carry out real-time hot deployment in normal mode. This needs to be configured in run confrgration.

5 、 JRebel

Jrebel is the best hot deployment tool developed by Java and provides excellent support for Spring Boot. JRebel is a paid software with a trial period of 14 days. Can be installed directly through the plug-in

This is the end of what are the five hot deployment methods of Spring Boot. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Configuration mode mode page cache content file method template scope name engine plug-in more limited template system change help good Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Xiaomi Shulou Technology Microsoft MariaDB