Spring Boot (2): Boot with jar package

Source: Internet
Author: User

We complete our example by creating a fully self-contained executable jar file that can be run in production env. An executable jar (sometimes called a "fat jars") is an archive file that contains the classes you compile and all the jar dependencies your code needs to run.

This example continues on the basis of Spring Boot (1): Guide.

(1) Add the following dependencies in Maven:

1     <!--can be punched into a runnable jar package -2     <Build>3         <Plugins>4             <plugin>5                 <groupId>Org.springframework.boot</groupId>6                 <Artifactid>Spring-boot-maven-plugin</Artifactid>7             </plugin>8         </Plugins>9     </Build>

(2) The Package command of the MAVEN build is compiled and packaged, and the jar is found in the target directory.

(3) Run the jar in the console.

$ Java-jar Springboot-0.0.1-snapshot.jar

(4) Open localhost:8080/.

(5) If you want to close, press ctrl-c inside the console.

Spring Boot (2): Boot with jar package

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.