Book Image

Spring Boot Cookbook

By : Alex Antonov
Book Image

Spring Boot Cookbook

By: Alex Antonov

Overview of this book

Table of Contents (15 chapters)
Spring Boot Cookbook
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a Spring Boot executable JAR


The Spring Boot magic would not be complete without providing a nice way to package the entire application including all of its dependencies, resources, and so on in one composite, executable JAR. After the JAR file is created, it can simply be launched by running a java –jar <name>.jar command.

We will continue with the application code that we built in the previous chapters and will add the necessary functionalities to package it. Let's go ahead and take a look at how to create the Spring Boot Uber JAR.

Note

The Uber JAR is typically known as an application bundle encapsulated in a single composite jar that internally contains a /lib directory with all the dependent inner jars and optionally a /bin directory with the executables.

How to do it…

  1. Let's go to our code directory from Chapter 5, Application Testing, and execute ./gradlew clean build.

  2. With the Uber JAR built, let's launch the application by executing java -jar build/libs/bookpub-0.0.1-SNAPSHOT...