The NonConformist Techie

Share this post

What is Quarkus? Is it an alternative to SpringBoot?

rubyvalappil.substack.com

Discover more from The NonConformist Techie

Easy-to-digest news on the latest tech trends and doable tips to generate passive income.
Continue reading
Sign in

What is Quarkus? Is it an alternative to SpringBoot?

Ruby Valappil
Aug 20, 2023
Share this post

What is Quarkus? Is it an alternative to SpringBoot?

rubyvalappil.substack.com
Share
Photo by Boitumelo on Unsplash

I was looking for an alternative to SpringBoot once, and a fellow programmer suggested I try Quarkus.

SpringBoot is still my favorite to develop Java-based services, but there is no harm in exploring alternatives. From my analysis so far, Quarkus is aimed at cloud-native, microservices, and serverless development.


Quarkus is an open-source project developed and sponsored by Red Hat. Red Hat engineers initiated the project and has since gained contributions from a diverse community of developers worldwide. 

Quarkus is part of Red Hat’s efforts to modernize Java for cloud-native and containerized environments. Red Hat sees Quarkus as a key technology to enable developers to build lightweight, fast, and efficient Java applications that are well-suited for microservices and serverless architectures.

As an open-source project, a community-driven process governs Quarkus, and contributions from various organizations and individuals play a crucial role in its evolution and improvement. 

Quarkus is a cloud-native and Kubernetes-native framework.


The framework was introduced to address the challenges faced by traditional Java applications in cloud-native environments. While Java is known for its robustness and scalability, it has often been criticized for its high memory consumption and slow startup times. 

Quarkus seeks to overcome these limitations and provide a more efficient platform for building cloud-native applications.

Key features and characteristics of Quarkus include:

  1. Supersonic Subatomic Java: Quarkus claims to provide supersonic speed and a subatomic memory footprint. It achieves this by using a technique called “GraalVM Native Image” to compile Java applications into native executables, which result in faster startup times and reduced memory usage.

  2. Microprofile and Jakarta EE Compatible: Quarkus is compatible with popular Java standards, including MicroProfile and Jakarta EE. This means developers can leverage existing libraries while building applications on Quarkus.

  3. Cloud-Native and Kubernetes-First: Quarkus is designed from the ground up to work well in cloud-native environments and is optimized for deployment on Kubernetes. It offers native integrations with Kubernetes features like ConfigMaps and Secrets.


Code

A sample API written in Quarkus project is given below. 

package com.example;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;

@Path("/books")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class BookResource {

    private List<Book> books = new ArrayList<>();

    @GET
    public Response getAllBooks() {
        return Response.ok(books).build();
    }
  
}

Notice that we are only adding Java libraries here to create APIs.


Personally, I found it more challenging to get the setup ready in my local machine to run the Quarkus app compared to how I usually go to spring initlzr, add dependencies, and get my app up and running in literally no time. But that could also be because I have spent years playing around with Spring-based projects, and the community support out there for Spring projects is much higher than the comparatively-new Quarkus project.

Anyways, do try this project and form your own opinion.

Happy coding!


Thank you for reading The NonConformist Techie. This post is public, so feel free to share it.

Share

Share this post

What is Quarkus? Is it an alternative to SpringBoot?

rubyvalappil.substack.com
Share
Comments
Top
New

No posts

Ready for more?

© 2023 Ruby Valappil
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing