IDEA achieve thermal deployment by spring-boot-devtools

Verbatim https://www.dazhuanlan.com/2019/08/25/5d622b4430fa1/


After each modify Java code to be recompiled deployment, debugging efficiency is too low. Online recommended spring-boot-devtools hot deployment can be achieved, so try it yourself the next.

Environment Installation

Environmental installation reference from this article: https://www.cnblogs.com/sprinkle/p/7058630.html

Configuring maven dependence

1
2
3
4
5
6
7

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>runtime</scope>
</dependency>

IDEA modify settings

1, "File" -> " Settings" -> "Build, Execution, Deplyment" -> "Compiler", 取消tick (which is to solve the problem Caton, will be mentioned later) "Build project automatically".
2, the key combination: "Shift + Ctrl + Alt + /", select the "Registry", select the tick "compiler.automake.allow.when.app.running".

Chrome disable caching

F12 or "Ctrl + Shift + I", open developer tools, select the tick under "Network" tab of the "Disable Cache (while DevTools is open)".

Experience

Hot deployment did not imagine fast

I did a test with the current development of a web project, found that every time the code changes saved, hot deployment takes about four seconds, compared to redeploy the entire project (takes about 7-8 seconds) faster half, but still did not like the script to achieve experience the extent of language as zero deployment.

Artifact adoption process run, the hot deployment does not take effect

In this way the process of running, tested modify the code is not triggered hot deployment.

Only for the original project SpringBoot Application class, this hot deployment to take effect.

The reason speculation is run by Artifact mode when using a separate set tomcat, not SpringBoot comes with tomcat, and devtools not affect this separate tomcat, and therefore does not take effect.

This issue has little effect on the general development when we are using the SB comes tomcat.

Opened automatic hot deployment, write code that will be apparent Caton

IDEA as long as you do not operate for a few seconds, it will automatically perform a save operation; coupled with the habit of saving actions ctrl + s, and occasionally click, resulting in saving code documentation is a very high frequency operation.

When setting up automatic compilation is running, it will trigger a save compile action, devtools hot deployment should be triggered by listening to compile action, thus leading to frequent hot deployment, CPU for a long time at a high load, leading computer Caton .

The solution is, do not set automatically compile and run, that do not check this:

Then you modify the code, to determine when it came into force, the shortcut key ctrl+F9to trigger hot deployment.

Guess you like

Origin www.cnblogs.com/petewell/p/11408050.html
Recommended