Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways for Spring Boot to achieve hot deployment

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the ways to achieve hot deployment of Spring Boot, the article is very detailed, has a certain reference value, interested friends must read it!

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. Therefore, we can disable the cache of template engine in application.properties, as follows: Thymeleaf configuration:

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=false2, using debug mode Debug for hot deployment

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

3. Spring-boot-devtools adds spring-boot-devtools dependencies to the Spring Boot project to achieve hot deployment of pages and code.

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 to manually click on restart, improves the effectiveness, and is 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

These are all the contents of the article "what are the ways for Spring Boot to achieve hot deployment?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report