Source: ruoli x my.oschina.net/ruoli/blog/1590148
- 1. Template hot deployment
- 2. Using debug mode to realize hot deployment
- 4、Spring Loaded
1. Template hot deployment
In spring boot, the page of the template engine is enabled for caching by default. If the content of the page is modified, the page cannot be refreshed after refreshing. Therefore, we can use the application.properties To turn off the cache of the template engine, as follows:
Configuration of thymeleaf:
Configuration of groovy:
2. Using debug mode to realize hot deployment
This method is the simplest and fastest way of hot deployment. When running the system, debug mode is used without installing any plug-ins. However, there is no need to change the configuration file, method name, add classes and methods for hot deployment, and the scope of use is limited.
Add spring boot devtools dependency in spring boot project to realize hot deployment of page and code.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId></dependency>
This method is characterized by a wide range of functions. Any changes to the system, including configuration file modification and method name change, can be covered. However, the sequelae is also very obvious. It is realized by using the strategy of restarting after file changes. It mainly saves the time for us to click restart manually, improves the effectiveness, and is slightly worse in experience.
Spring boot devtools turns off the template cache by default. If you use this method, you do not need to configure it separately to turn off the template cache.
This method is similar to debug mode and has limited scope of application. However, it does not depend on the startup of debug mode. Starting through the spring loaded library file, real-time hot deployment can be carried out in normal mode. This needs to be configured in run configuration.
Jrebel is the best hot deployment tool for java development, which provides excellent support for spring boot. Jrebel is a paid software with a trial period of 14 days. Can be installed directly through plug-ins.
If there are any errors or other problems, you are welcome to comment and correct. If you have any help, please click like + forward to share.
Welcome to the official account of the brother of migrant workers:Migrant workers’ technology road