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