Skip to main content

Development

Simplify Cloud-Native Development with Quarkus Extensions

Quarkus

The gradients that developers in the modern world experience when building cloud native applications often include the challenge of figuring out the right set of libraries and integrations to use. Quarkus alleviates this pain point and makes this experience a more seamless and faster experience to develop thanks to the rich set of extensions built into the Quarkus ecosystem. Extensions are pre-integrated capabilities that help to maximize developer delight and runtime performance. In my previous blog, I discussed how Quarkus live coding enhances the dev experience . Today, let’s dive deeper into Quarkus Extensions .

Why Extensions Matter

The traditional layers of a Java stack often include some manual configuration and glue code to piece together the various libraries, as well as interceptors that need to be integrated too. Quarkus changes the game by providing extensions that are:

  • Optimized for build time and runtime performance

  • Preconfigured to reduce boilerplate

  • Integrated seamlessly with Quarkus dev services

  • Compatible with native compilation via GraalVM

This means you have less setup, faster feedback loops, and more time to write business logic.

Top Extensions to Explore

 RESTEasy Reactive

Create RESTful APIs with minimal configuration and blazing-fast performance. Quarkus supports both classic RESTEasy and the newer RESTEasy Reactive, which is designed for reactive programming models.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Path("/hello")
publicclass HelloResource {
@GET
publicStringhello(){
return"Hello from Quarkus!";
}
}
@Path("/hello") public class HelloResource { @GET public String hello() { return "Hello from Quarkus!"; } }
@Path("/hello")
public class HelloResource {
    @GET
    public String hello() {
        return "Hello from Quarkus!";
    }
}

Hibernate ORM with Panache

Panache simplifies JPA by reducing boilerplate code and making your data layer expressive and concise.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Entity
publicclass Person extends PanacheEntity {
publicString name;
publicstatic Person findByName(String name){
returnfind("name", name).firstResult();
}
}
@Entity public class Person extends PanacheEntity { public String name; public static Person findByName(String name) { return find("name", name).firstResult(); } }
@Entity
public class Person extends PanacheEntity {
    public String name;
    public static Person findByName(String name) {
        return find("name", name).firstResult();
    }
}

Kubernetes & OpenShift

Quarkus offers native support to generate deployment YAMLs, making it cloud-native out of the box.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
./mvnw clean package -Dquarkus.kubernetes.deploy=true
./mvnw clean package -Dquarkus.kubernetes.deploy=true
./mvnw clean package -Dquarkus.kubernetes.deploy=true

You can also configure deployment details using application properties like:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
quarkus.kubernetes.name=my-app
quarkus.kubernetes.replicas=3
quarkus.kubernetes.name=my-app quarkus.kubernetes.replicas=3
quarkus.kubernetes.name=my-app
quarkus.kubernetes.replicas=3

SmallRye (MicroProfile)

Need configuration, health checks, metrics, or OpenAPI? Just add the right SmallRye extension.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
./mvnw quarkus:add-extension -Dextensions="smallrye-health"
./mvnw quarkus:add-extension -Dextensions="smallrye-health"
./mvnw quarkus:add-extension -Dextensions="smallrye-health"

Then add a health endpoint:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@Health
@ApplicationScoped
publicclass LivenessCheck implements HealthCheck {
@Override
public HealthCheckResponse call(){
return HealthCheckResponse.up("I'm alive!");
}
}
@Health @ApplicationScoped public class LivenessCheck implements HealthCheck { @Override public HealthCheckResponse call() { return HealthCheckResponse.up("I'm alive!"); } }
@Health
@ApplicationScoped
public class LivenessCheck implements HealthCheck {
    @Override
    public HealthCheckResponse call() {
        return HealthCheckResponse.up("I'm alive!");
    }
}

Getting Started

Adding extensions is a breeze using the Quarkus CLI or Maven plugin:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
quarkus ext add 'hibernate-orm-panache'
quarkus ext add 'hibernate-orm-panache'
quarkus ext add 'hibernate-orm-panache'

Or:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
./mvnw quarkus:add-extension -Dextensions="rest-easy-reactive, kubernetes"
./mvnw quarkus:add-extension -Dextensions="rest-easy-reactive, kubernetes"
./mvnw quarkus:add-extension -Dextensions="rest-easy-reactive, kubernetes"

Conclusion

The Quarkus Extensions are a great way to include common features in your application without worrying about how all the complicated pieces fit together. If you’re building REST APIs, integrating with databases, deploying Kubernetes applications, there is likely an extension that can help. It is a very exciting time if you’re trying to upgrade your Java technology stack for the cloud.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

G. Raveena Nair

Meet Raveena Nair, Lead Technical Consultant at Perficient and a skilled IT professional with 9+ years of experience in the industry. She is passionate about exploring the latest technologies and is focused on mastering the MERN stack/Full Stack and cyber security. Having spent all her years in development, Raveena possesses a wealth of experience and expertise in various programming languages, including Node, React.js, NEXTJs, Python, Basic Java, and Salesforce platform. Additionally, she has hands-on experience in Android and Linux Automation (Shell). Before Perficient, she has contributed to providing add-on features to clients along with ongoing projects and timely deliverables. Received accolades and awards from senior executives in a short tenure. Constantly striving to leverage her skills and experience to enhance the overall user experience for clients and end-users alike.

More from this Author

Follow Us