Overview
Get a practical introduction to Quarkus, the full-stack framework for building cloud-native Java applications, with Quarkus in Action.
This hands-on guide teaches you how to use Quarkus to build resilient, scalable applications. Building on an example car rental application, you’ll explore technologies that integrate with Quarkus to provide functionalities integral to modern applications.
Dive into features that make Quarkus application development unique:
- Use Quarkus Dev mode to speed up and enhance Java development
- Observe and troubleshoot running applications using the Dev UI
- Automate background testing with the Continuous Testing feature
- Integrate frameworks and libraries such as Reactive Messaging, gRPC, and GraphQL
- Easily deploy applications on Kubernetes and Red Hat OpenShift
- Automatic management of remote services such as databases and message brokers
This book is ideal for intermediate Java developers with experience developing server-side Java applications.
Excerpt
With a vast ecosystem of libraries, frameworks, standards, runtimes, and experienced developers, Java is a great choice for building modern, robust, and scalable software. In today’s data-oriented, cloud-first, cost-sensitive world, Java is also sometimes viewed as mature, slow, and resource-intensive. Quarkus changes this perception, offering a fast, lightweight, and flexible Java framework perfect for modern enterprise applications.
Quarkus combines popular libraries, Java standards, and best practices with an innovative approach to building and running applications, delivering both great user experience and developer productivity. Its build processing-oriented architecture results in smaller and faster runnable artifacts, perfect for contemporary designs like microservices and serverless as well as more traditional monolithic applications. It’s also great for specialized use cases like CLI apps, edge, GitHub actions, and Kubernetes operators.
In this book, we’ll show you how to build Java applications using Quarkus from the ground up, gradually working toward an enterprise system consisting of multiple Quarkus microservices. Along the way, we will explain the main concepts, tools, and features of Quarkus to help you understand where and how Quarkus can be a good fit for your next projects.
1.1 Why Quarkus?
It’s natural to ask, “Why do I need to learn a new framework when we already have framework X?” Java frameworks like Spring have been around for years and have extensive public documentation, problem solutions, and user stories, as well as massive legacy codebases. When these frameworks were designed—in some cases, 20+ years ago—the Java world was very different.
Java was originally designed for big, long-running applications, which created a perception that it didn’t fit particularly well into modern computing environments. With the move to the cloud environments, application startup times and memory/CPU utilization became the prominent application metrics. Long starts and the high memory use of Java applications are no longer acceptable since such processing translates directly into cloud costs.
Quarkus was created to address these challenges. It defines a very lightweight framework that splits the application processing into the build-time and runtime phases. Any Java stack needs to do a lot of processing once the application starts—for example, reading and processing the application’s code, annotations, configuration, injection points (inversion of control), or generating dynamic code to initialize the application within the framework properly. And all of this processing repeats with every application start.
Quarkus moves as much processing as possible to the build-time phase (application build/packaging) to save resources at runtime. The packaged application carries only the results of these initial framework operations, which makes it not only faster to start since they don’t need to be executed at startup but also smaller in size because any code that is needed only in this initialization phase is never included in the final packaged artifact.
While performance benefits are very important, Quarkus also puts enormous effort into the developer experience when using the framework. It provides the Dev mode, which is a continuous execution of the Quarkus application, allowing live reloads of code and configuration changes. By just saving our changes in the editor and invoking the application, Quarkus dynamically applies those changes so we can see the results of our modifications in mere milliseconds. The development flow doesn’t need to stop to recompile and rerun the application, which closes the reevaluation loop in a continuous experience similar to scripting languages while we still work with the Java virtual machine (JVM). Dev mode bundles a lot of productivity boosting features that we dive into in this book.
Quarkus also exposes all these features for integrations, which makes it very popular among library developers too. With its over 700 extensions (pluggable pieces of functionalities) that integrate different popular libraries (e.g., Hibernate, Jackson, or LangChain4j), Quarkus proves that it stands out as a framework where the Java ecosystem wants to be.