Two ways to implement a hot deployment based on MAVEN's Springboot project

Source: Internet
Author: User

Here I'll show you two ways to implement a hot deployment in a Springboot project built with MAVEN, making deployment incredibly simple, and both in a very simple way.

Hot Deployment Devtools

Add dependencies directly in Pom.xml:

 <dependency> <groupid>org.springframework.boot</< Span class= "Hljs-title" >groupid> <artifactid> Spring-boot-devtools</artifactid>  <scope>provided</scope> Span class= "hljs-comment" ><!--Optional I did not understand, all said must be true, but I test true,false, do not add all can--<< Span class= "Hljs-title" >optional>true</optional> </DEPENDENCY>        

Start with the project main program portal, and then recompile after the change.

springloaded

Add dependencies directly to the Spring-boot plugin in the Pom.xml:

<Plugin><Groupid>org.springframework.boot</Groupid><Artifactid>spring-boot-maven-plugin</Artifactid><Dependencies><!--Spring Hot deployment--<Dependency><Groupid>org.springframework</groupid> <artifactId> Springloaded</artifactid> << Span class= "Hljs-title" >version>1.2.6.release</version > </dependency> </dependencies> <configuration> <mainclass>cn.springboot.mainspringboot</< Span class= "Hljs-title" >mainclass> </configuration> Span class= "Hljs-tag" ></PLUGIN>        

Run:

$ mvn clean spring-boot:run

After the change, the compilation can implement the hot deployment

Conclusion

Both of these approaches are actually spring's web site for the spring project of the jar package, coupled with the advantages of Springboot framework embedded server, making the modified project deployment is very simple; When I use these two methods later, I find that the only real thermal deployment is the latter, The former only realizes the hot start, which can be seen from the console log.

Description
    • The project uses MAVEN management, otherwise this simple and useful article is not for you
    • The first way configuration file changes cannot touch the hot start
    • Second way configuration file changes cannot touch the hot deployment, will prompt the error

Two ways to implement a hot deployment based on MAVEN's Springboot project

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.