Quarkus: Get started with Kubernetes-native Java


Quarkus is a full-stack, open-source Java framework launched in 2019 by Red Hat. Quarkus is an alternative to Spring (although it can also be integrated with Spring), with some interesting features all to itself.

Quarkus is designed from the ground up to be “cloud-native,” meaning it’s tuned for Kubernetes, serverless platforms, and a variety of libraries like Apache Kafka (for stream processing) and JAX-RS (for RESTful web services). Quarkus also sports a full CDI (contexts and dependency injection) engine and Reactive programming support.

Read on for a hands-on introduction to Quarkus.

Install the Quarkus CLI

Quarkus supports Maven and Gradle as build tool wrappers, but also ships with a command-line interface (CLI) tool. We’ll begin by installing the CLI via the JBang tool. From the command line, run the code in Listing 1.

Listing 1. Installing the Quarkus CLI

// Linux and iOS: 
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio

// PowerShell:
iex "& { $(iwr https://ps.jbang.dev) } app install --fresh --force quarkus@quarkusio"

Once the command completes, typing quarkus -version should return a result.

Create a Quarkus app

Create a new app by typing quarkus create app com.infoworld:my-quarkus:1.0, where com.infoworld is the group ID, my-quarkus is the artifact ID, and 1.0 is the version number.

Copyright © 2021 IDG Communications, Inc.



Source link