A Review of Spring Boot Alternatives

At present, there is no lack of frameworks for creating miсroservices in Java and Kotlin. In this article, we will be considering the following frameworks:

Name Version Year of a first release Developer GitHub

Helidon SE

”Hello, Micronaut” Using Microstarter.io

For the past couples of months, I've worked to develop an online starter that helps developers generate Micronaut applications based on Micronaut-Profile Project templates. The Micronaut online starter was published on the Microstarter.io website. In this article, we will create a REST web service powered by the Micronaut framework using Microstarter.io. Let's get to it!

What Is Micronaut?

In a nutshell, Micronaut is a lightweight, JVM-based framework that's ahead of compilation time, with less startup time natively.

Micronaut Mastery: Change the Default Package for Generated Classes

When we use the Micronaut command line commands to generate controllers, beans, and more, the classes will have a default package name. We can use a fully qualified package name for the class we want to generate, but when we only define a class name, Micronaut will use a default package name automatically. We can set the default package for an application when we first create an application with the create-app command. But we can also alter the default package name for an existing Micronaut application.

To set the default package name when we create a new application we must include the package name in our application name. For example when we want to use the default package name mrhaki.micronaut for an application that is called book-service we must use the following create-app command:

Kotlin Microservices With Micronaut, Spring Cloud, and JPA

The Micronaut Framework provides support for Kotlin built upon the Kapt compiler plugin. It also implements the most popular cloud-native patterns, like distributed configuration, service discovery, and client-side load balancing. These features allow you to include an application that's been built on top of Micronaut into an existing microservices-based system. The most popular example of such an approach may be integration with the Spring Cloud ecosystem. If you have already used Spring Cloud, it is very likely you built your microservices-based architecture using the Eureka discovery server and Spring Cloud Config as a configuration server. Beginning with version 1.1, Micronaut supports both these popular tools as part of the Spring Cloud project. That's good news because, in version 1.0, the only supported distributed solution was Consul, and there was no way to use Eureka discovery together with Consul's property source (running them together ends with an exception).

In this article, you will learn how to:

A Quick Guide to Microservices With the Micronaut Framework

The Micronaut framework was introduced as an alternative to Spring Boot for building microservice applications. At first glance, it is very similar to Spring. It also implements patterns like dependency injection and inversion of control based on annotations, however, it uses JSR-330 (java.inject) to do it. It has been designed specifically for building serverless functions, Android applications, and low memory-footprint microservices. This means that it should have a faster startup time, lower memory usage, and be easier to unit test than competing frameworks. However, today I don't want to focus on those characteristics of Micronaut. I'm going to show you how to build a simple microservices-based system using this framework. You can easily compare it with Spring Boot and Spring Cloud by reading my previous article about the same subject Quick Guide to Microservices with Spring Boot 2.0, Eureka and Spring Cloud. Does Micronaut have a chance to gain the same popularity as Spring Boot? Let's find out.

Our sample system consists of three independent microservices that communicate with each other. All of them integrate with Consul in order to fetch shared configurations. After startup, every single service will register itself in Consul. The applications organization-service and department-service call endpoints exposed by other microservices using the Micronaut declarative HTTP client. The traces from communication are sent to Zipkin. The source code of the sample applications is available on GitHub in the sample-micronaut-microservices repository.