Fun Springboot hot deployment of 2 (DevTools)

Devtools Introduction

SpringBoot provides the ability to deploy heat, that what is hot deployment tired? SpringBoot official had this to say: as long as the files on the class path changes, it will automatically restart the application. When working in the IDE, this may be a useful feature, because it provides a very rapid change of the feedback loop for the code. By default, the entry point to change any folder on monitoring the classpath. Please note that some resources (such as static assets and view templates) without restarting the application.

Trigger restart
due DevTools monitor classpath resources, so the only way to trigger a restart is to update the class path. Lead to update the class path depends on whether you use IDE. In Eclipse, Save the modified file will lead to update the class path and trigger a restart. In IntelliJ
IDEA construct item (Build -> Build Project) has the same effect.

Meanwhile DevTools also provides the functionality to run remote applications, in fact, is to modify the native code can be updated in real time to a remote application, so you can achieve remote server code to native code and joint debugging.

DevTools operation using hot deploy

Eclipse uses SpringBoot DevTools

The first step is the introduction of spring-boot-devtools dependent, specific code as follows:

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

Then get away with it. We can use, modify pages and what kind of projects do not need to restart the aha.

IntellJ IDEA 使用SpringBoot DevTools

The first step is the introduction of spring-boot-devtools dependent, specific code as follows:

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

You may think have done by now, but I can certainly tell you NO NO NO, need to do a little configuration.

The second step starts automatically compile the function. Specific operation is as follows:

File -> Settings -> Build, Execution, Deplyment -> Compiler , select the tick Build Project Automatically . FIG Specific operation is as follows:
Here Insert Picture Description
Here Insert Picture Description
The third step is provided during program execution, still allow automatic compiled. Specific operation is as follows:

Use the shortcut keys the Shift + Ctrl + Alt + / , click the Registry Options, select compiler.automake.allow.when.app.running do the following diagram:
Here Insert Picture Description
Here Insert Picture Description
after the completion of the above operations can be carried out safely SpringBoot development projects on the IntellJ IDEA , do not worry about the restarting of friends.

DevTools common configuration Introduction

In terms of the normal course of use DevTools is no configuration, if you need a custom directory and restart without restarting the directory and other information, then, SpringBoot also provides us with the specific configuration items in application.properties in.

Common configuration is as follows:

spring.devtools.restart.log-condition-evaluation-delta = false # Disable log reports
spring.devtools.restart.exclude = static / , public / # restart without modifying the trigger file directory
spring.devtools.restart.additional-exclude # default configuration also requires the exclusion in the new directory
spring.devtools.restart.additional-paths = # add the path restarts after the need to monitor the need to change the file
spring.devtools.restart.enabled = true # whether to restart the disabled

Guess you like

Origin www.cnblogs.com/jerry126/p/11531314.html