MAVEN Engineering uses Spring-boot-devtools for hot deployment, changing code to avoid restarting the Web container

Source: Internet
Author: User

http://blog.csdn.net/zhoujinyu0713/article/details/46843115

Spring-boot-devtools is a module for developers, and the most important feature is the automatic application of code changes to the latest apps. Related blog: Click to open the link

The principle is to restart the application after discovering that the code has changed, but faster than the speed of the manual stop, and faster than the time saved by manual operation.

The underlying principle is to use two ClassLoader, one ClassLoader to load the classes that will not change (third-party jar packages), and another ClassLoader to load the changed classes, called Restart ClassLoader

, so that when there is code change, the original restart ClassLoader is discarded, re-create a restart ClassLoader, due to the need to load fewer classes, so a faster restart time (less than 5 seconds).

Since Devtools is only in Spring milestone repository. Warehouse is available, and the default warehouse version is 1.2.5.RELEASE, so you need to configure the warehouse address in the Pom.xml file.

<repositories>      <repository>          <id>spring-milestones</id>          <name>spring Milestones</name>          <url>http://repo.spring.io/milestone</url>          <snapshots>              <enabled>false</enabled>          </snapshots>      </ Repository>  

Then change the parent label

<parent>      <groupId>org.springframework.boot</groupId>      <artifactId> spring-boot-starter-parent</artifactid>      <version>1.3.  0. M2</version>  </parent>  

Finally add the module dependency can be

<dependency>         <groupId>org.springframework.boot</groupId>         <artifactId> Spring-boot-devtools</artifactid>   </dependency>  

As for the use of the module, as long as the dependency is written in the line, do not need other special action, use the example click here to have a video show, or pretty clear.

Pay special attention to Because the inheritance of the Pom.xml version is 1.3.0.m2, the original dependent on the inside if you omit version, but in the 1.3.0.m2 without the module will be error, this time only need to manually add the dependent version coordinates, written as the original 1.2.5.RELEASE can be.

MAVEN Engineering uses Spring-boot-devtools for hot deployment, changing code to avoid restarting the Web container

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.