Springboot simplified development of thermal deployment startup configuration

Source: Internet
Author: User

Rust-Tease Brain
Original link: http://www.cnblogs.com/ocean-yh/p/8352032.html

Discussion QQ Group: 151230186

Hot deployment configuration at Spring Boot development

About Springboot Here we do not do too much of the introduction, if you need to know springboot, please search the springboot about the relevant information.

This article is intended to give you an elegant way to use the Springboot development project without the time wasted during the frequent restart of the project, as quickly and conveniently as writing HTML to refresh the page to see the effect of the Change code:)

Note: The development tool used here is the Eclipse

1. Use springloaded to configure the hot deployment of the project

Features: does not restart the project, after the save is effective

Insufficient: new requestmapping in controller using SPRINGMVC will not take effect immediately, need to restart project

Configuration steps:

A. First include the following configuration in the Pom.xml file:

1 <Build>2         <!--Add Springloader plugin here -3         <Plugins>4             <plugin>5                 <groupId>Org.springframework.boot</groupId>6                 <Artifactid>Spring-boot-maven-plugin</Artifactid>7                 <!--Hot Deployment Configuration-immediate effect configuration after modification (the method of creating a new access path in the controller does not take effect immediately) -8                 <executions>9                     <Execution>Ten                         <Goals> One                             <goal>Repackage</goal> A                         </Goals> -                         <Configuration> -                             <classifier>Exec</classifier>> the                         </Configuration> -                     </Execution> -                 </executions> -                  +             </plugin> -         </Plugins> +</Build>

B. Download the Springloaded-1.2.4.release.jar package, create a new LIB package in the project root directory and put the downloaded jar package

      

C. Setting the Startup class configuration

Click the right mouse button in the startup class of the Project > select Run as > Run configurations

Find the startup class for the project in Java application, such as setting the value of VM arguments -javaagent:.\lib\springloaded-1.2.4.release.jar-noverify

Note: This point points to the Springloaded.jar package for the project root, and if the jar package is introduced with Pom.xml, it can only be configured to the corresponding jar file directory .

After the configuration is complete we have configured the hot deployment using springloaded, right-click Start class > Run as > Java application Startup Project, you can start our code to experience writing the save can directly see the effect of the coding journey

2. Use Spring-boot-devtools to configure the hot deployment of the project

Features: automatic restart of the project, after the save is a compile restart

Configuration steps:

This configuration is much simpler than the one above, and the following configuration is added directly to the Pom.xml

First introduce the supported JAR packages

<Dependency>    <groupId>Org.springframework.boot</groupId>    <Artifactid>Spring-boot-devtools</Artifactid>    <Optional>True</Optional></Dependency>

Then add the configuration with the hot deployment enabled

<Build>    <Plugins>        <plugin>            <groupId>Org.springframework.boot</groupId>            <Artifactid>Spring-boot-maven-plugin</Artifactid>            <!--immediate effect After starting the modification -            <Configuration>                <Fork>True</Fork>            </Configuration>        </plugin>    </Plugins>    <Defaultgoal>Compile</Defaultgoal></Build>           

This is done by using Spring-boot-devtools to configure the hot deployment project.

Each of the two ways has its own characteristics, I hope this article configuration can help you better experience the development of Springboot tour:)

Rust-Tease Brain
Original link: http://www.cnblogs.com/ocean-yh/p/8352032.html

If there are shortcomings in this article also hope to correct in time, discuss QQ group: 151230186

This article is copyright to the author and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.

Springboot simplified development of thermal deployment startup configuration

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.