Fast memory keep trying
Introduce devtools
Spring-boot-devtools provides a set of development tools, spring-boot-DevTools, to improve the productivity of developers. Developers can include this module in any project. The most convenient part of Spring-boot-DevTools is hot deployment, which means idea automatically helps you Restart the project when you make any code changes.
Basic usage
To add DevTools to your project, add the following dependencies:
An optional option is added to prevent dependencies from being passed to other modules.
The effect that
After the introduction, the project will automatically restart as soon as the classpath file changes. This will greatly improve the development efficiency. Using IDEA as an example, by default, the project needs to be manually compiled to restart, click build-> BuildProject menu or shortcut key CTRL + F9, of course, you can also use automatic compilation . The first stepStep 2 Press Ctrl+ Shift + Alt +/ to bring up the Maintenance page
Click the Registry, in the new open pages on the compiler. Check the automake. Allow. The when. App. Running
That’s it. After these two steps of configuration, if you modify the code in IDEA, the project restarts automatically.
Matters needing attention
The project does not automatically restart when static resources or view templates under the classpath change.
The basic principle of
The automatic restart technique used in Springboot involves two class loaders. One is the BasecLassLoader, which is used to load classes that do not change, such as third-party JAR packages that the project may have to import. The other is the RestarClassLoader, which is used to load classes that the developer has written that will change. When the project needs to be restarted, the RestartClassLoader will be replaced by a newly created classloader, and the BasecLassLoader will continue to use the original one, which is much faster than a cold start because the BasecLassLoader already exists and is loaded. A new day, as long as output will be harvest. OK, the level is limited, thanks god to point out.