Building Microservices with Spring Boot Fat (Uber) Jar

In most 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.

jelastic spring boot microservices tutorial

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.

building microservices

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

maven archetype spring boot

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

java spring boot

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.

how to build microservices

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

spring boot uber jar

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.

spring boot microservices example

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

spring boot maven tutorial

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

spring boot maven

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.

spring boot maven plugin

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.

Topics:

Don’t Forget to Share This Post!

Comments (0)

Your email address will not be published. Required fields are marked *

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

Related Articles

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard