Building Microservices with Spring Boot Fat (Uber) Jar

14

1672-1-spring-boot-logoIn 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 a 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, Jelastic has 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.

1672-1-maven-microservice-package

Installation of Spring Boot Fat (Uber) Jar Builder

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

1672-1-spring-boot-fat-jar-builder

Or you can Import the required manifest using the link from GitHub:

https://github.com/jelastic-jps/spring-boot/blob/master/microservice-fat-jar/manifest.jps

1672-1-import-fat-jar-manifest

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

1672-1-spring-boot-fat-jar-installation

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 the Tasks panel). In the default implementation, it is done under the api/greeting context.

1672-1-fat-jar-microservice-deployment

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

1672-1-fat-jar-jelastic-paas-url

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.

1672-1-set-of-microservices-in-maven-node

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

1672-1-java-engine-environment

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

1672-1-add-project-to-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.

1672-1-deploy-application

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.

SOURCEJelastic, Inc.