SpringBoot hot start allows developers to more easily

 During development, when finished we need to run a functional application testing, there may be little more than a small function bug, we need to be corrected to restart the server, this invisible slow down the speed of development has increased development time, SpringBootproviding up spring-boot-devtools, and enable us to change the application configuration file, restart the application automatically!

Open the pom.xmlfile to add dependencies

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

        As long as the classpathfiles are changed, it will automatically restart. This is useful when using the IDE, because it can quickly change the code feedback. By default, classpathany point to Folder entity will be monitored, pay attention to modify some resources such as static assets, view templates without restarting the application.
        Since DevToolsmonitoring classpathresources under, so the only way to trigger restart is updated classpath. In the Eclipseinside, save a modified file will cause the classpathupdate, and trigger the restart. In IntelliJ IDEA, the default is not automatically compiled, we need to set the automatic compilation.

IDEA is set to automatically compile:

        (1). Shortcut keys Ctrl+Alt+Sto open the settings, Build, Execotion, Deployment-> Compiler-> Build Project automatically checked items

 
 

        (2). Shortcuts Ctrl + Shift + Alt + /, choose Registry

 
 

        (3).勾选 Compiler autoMake allow when app running

 
 

        Restart the application, when changes to the code, watch the console output, you will find Spring Boot has detected a change in the file, and restart, you will find the experience so why stick, very cool!



Author: Le silly ass
link: https: //www.jianshu.com/p/0f62cab718ef
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.

Guess you like

Origin www.cnblogs.com/yachao1120/p/11104425.html