Building Microservices with Spring Boot Fat (Uber) Jar

By 21. 8. 2018 Containers, Java

In most of the minds, microservices is an approach to make a traditional monolithic system more structured, dividing it into logical components that correspond to different functional areas of application. Thus, acting as a microservice, each component becomes self-contained, easily scaled, maintained and even upgraded without affecting the overall system. Also, with microservice architecture, you can use a software written in different programming languages, including Java. Such freedom attracts but may frighten at the same time.

You can spend hours reading numerous articles in the net, regarding how to build microservices along with some boring examples. However theory without practice gets nowhere.

For a quick start, we have prepared a package with Maven and popular framework Spring Boot inside Java Engine node. It automates building a sample Java project as Fat (or so-called Uber) Jar to run it as a microservice.

Installation of Spring Boot Fat (Uber) Jar Builder

To get started, log in to Unispace dashboard, find the Spring Boot Fat Jar Builder in the Marketplace and click Install.

If required, change installation settings such as environment name or Git repository link to a custom Spring Boot project. Then press Install.

When the installation and building of the project are completed, a corresponding message appears. You still need to wait a few minutes for deploy to be finished (feel free to track the process in Tasks panel). In the default implementation, it is done under api/greeting context.

Afterwards, you can make sure, that application is up and running by pressing Open in browser button.

Running Multiple Microservices with Spring Boot Projects

You can use just created Maven node for building extra projects and deploying them to different environments to get a set of distributed microservices.

First of all, create a separate environment with Java Engine.

Then click Add Project next to the Maven node in the initial environment.

Specify the name and link to the project, as well as choose the environment where it should be deployed. Additionally, you can activate automatic updates. Then confirm pressing Add + Deploy.

More details on how to build and deploy Java applications can be found at the Maven node documentation.

In this way, you can easily build and deploy your Spring Boot based applications packaged in JAR files using Fat/Uber approach. Register and try out this implementation for your custom project to feel the benefits of microservices running in the cloud.

Leave a Reply