Spring Boot 1.5.4 Integrated Devtools (v)

Source: Internet
Author: User

Previous article: Spring Boot 1.5.4 Integrated JSP (iv)

1.1    Spring BootIntegratedDevTools

Spring Boot Integrated devTools Source:https://git.oschina.net/wyait/springboot1.5.4.git

Implementation steps:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/A6/08/wKioL1nIVAriubzoAAAeODFa8uo566.png "title=" 00.png "alt=" wkiol1nivariubzoaaaeodfa8uo566.png "/>eclipse Project must turn on Build automatically , if the auto-compile feature is turned off, the hot deployment is not valid.

1. Pom introduces DevTools dependency and plug-in configuration





& nbsp;       <optional>true</optional>

& nbsp;       <!--optional=true, Dependency is not passed, the project relies on devtools springboot1 Project project If you want to use devtools -->


2. Can be adjusted as needed application.properties file (Specific configuration content reference: Application.propertis )

    • in application.properties Configure spring.devtools.restart.enabled=false restart The class loader also initializes, but does not monitor file updates.

system.setproperty ( " spring.devtools.restart.enabled false can completely turn off restart support, configuration content:

  • /meta-inf/ Maven /meta-inf/ Resources / Resources /static /templates Span style= "font-size:16px;font-family: ' The song Body '; >, /public File modifications under these folders will not cause the app to restart, but will reload ( embedded a livereload server

  • If you want to change the default settings, you can set your own directory without restarting: spring.devtools.restart.exclude=static/**,public/** , so that only the file modifications under these two directories will not cause Restart the operation.

  • If you want to add additional exclude directories based on the remaining default settings: Spring.devtools.restart.additional-exclude

  • if you want to make proper non- Classpath the application restarts when the file is changed, using: spring.devtools.restart.additional-paths , so Devtools This directory will be included in the listening scope.

3. Start, Test

  • Modify Class – > Save: App will restart

  • Modify the configuration file – > Save: App will restart

  • Modify Page – > Save: The app will not reboot but will reload and the page will refresh (the principle is to Spring.thymeleaf.cache set to false , reference : Spring Boot Configure the template engine)

  • Integration Problem Description

If you use Dubeg as Start, the breakpoint is entered: silentexitexception . Normal startup does not have this problem.

( 1 ) Devtools you can implement a hot page deployment (that is, the page is modified to take effect immediately, which can be directly application.properties Configuration in Files Spring.thymeleaf.cache=false to implement a hot deployment of a property file by implementing a hot deployment of the class file, which does not take effect immediately after the class file is modified. that is , devtools will listen for file changes under Classpath, and will immediately restart the application (taking place at the time of saving), Note: This restart is very fast because of the virtual machine mechanism it uses

(2) After the configuration has been modifiedJavathe file also supports hot-start, but this is a project restart (faster project restart) that clearsSessionthe value in the, that is, if a user login, the project will need to re-login after restart. By default,/meta-inf/maven,/meta-inf/resources,/resources,/static,/templates,/publicfile modifications Under these folders will not cause the app to restart, but will reload (Devtoolsembedded in alivereload ServerWhen the resource changes, the browser refreshes).

Spring Boot Series Articles:

Spring Boot 1.5.4 Overview (i)

Spring Boot 1.5.4 Introduction and Principles (ii)

Spring Boot 1.5.4 the Web Development (iii)

Spring Boot 1.5.4 Integrated JSP (iv)

Spring Boot 1.5.4 Integrated Devtools (v)

Spring Boot 1.5.4 Integrated JdbcTemplate (vi)

Spring Boot 1.5.4 Integrated SPRING-DATA-JPA (vii)

This article is from the IT Technology Solutions blog, so be sure to keep this source http://wyait.blog.51cto.com/12674066/1968302

Spring Boot 1.5.4 Integrated Devtools (v)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.