In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the use of Spring Boot devtool". In the daily operation, I believe that many people have doubts about the use of Spring Boot devtool. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about the use of Spring Boot devtool. Next, please follow the editor to study!
The use of Spring Boot devtool
Spring Boot provides us with a convenient environment for developing Spring Boot applications. At the same time, in order to facilitate our development of Spring Boot applications, Spring Boot launched Spring Boot devtool tools to facilitate us to develop and test Spring Boot applications more quickly.
We will explain the functions of Spring Boot devtool in detail from the following aspects.
Add Spring Boot devtool dependency
Adding Spring Boot devtool dependencies is simple:
Org.springframework.boot
Spring-boot-devtools
With this addition, we can start using the excellent features that Spring boot devtool brings to us.
Default attribute
Spring Boot provides us with many automatic configurations to improve the efficiency of our development, such as caching template engines such as thymeleaf, but if we may need to quickly see the modified results in the development process, we do not need the cache configuration at this time, so we need to configure:
Spring.thymeleaf.cache=false
If spring-boot-devtools is added, the above configuration does not need to be added manually, and devtool will automatically add it for us.
Automatic restart
In the process of development, if we modify some java files, we may need to restart the next project to see the modified results. If we use spring-boot-devtools, devtools will automatically restart the server for you when there are file changes in classpath.
Note that the condition for restart here is that there are changes in classpath files. If you are using IDEA development, please check the "Build project automatically" option, as shown in the following figure, otherwise you need to re-build the project to make the restart effective.
Image
Live Reload
Live Reload is mainly for resource files. After our APP is started, we can see one:
O.s.b.d.a.OptionalLiveReloadServer: LiveReload server is running on port 35729
When the resource file changes, it is convenient for the front end to refresh.
If you want to use this live reload feature, you need to install a Remote Live Reload plug-in in your chrome browser.
Image
This plug-in mainly establishes a WebSocket connection between the livereload service and the browser through the introduced script livereload.js. Whenever the change of the file is detected, the livereload service will send a signal to the browser, and the browser will refresh the page after receiving the signal, realizing the effect of real-time refresh.
Global configuration
Spring-boot-devtools provides a global configuration file to facilitate the configuration of your development environment, which is located in .spring-boot-devtools.properties under the $HOME directory.
At this point, the study of "how to use Spring Boot devtool" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.