Create Quarkus Project With code.quarkus.io: Hello world example

In this article, we will learn how to create a simple Quarkus project with code.quarkus.io. code.quarkus.io is a great tool to quickly bootstrap your Quarkus projects.


Create Quarkus Project With code.quarkus.io


Let's create a Quarkus project step by step.

Step 1. Launch Quarkus Initializr using https://code.quarkus.io/ link
Step 2. Specify Project Details 


Look at the above diagram, we have specified the following details:
  • Build Tool: Maven
  • Group: org.knf.dev.demo
  • Artifact: code-with-quarkus
  • Search & Pick extensions: RESTEasy JSON-B
Once, all the details are entered, click on Generate your application button will generate a Quarkus project and downloads it. Next, Unzip the downloaded zip file and import it into your favourite IDE.


Step 3. Import project in your favorite IDE.I am using IntelliJ IDEA.

In IntelliJ IDEA, Click Open


Navigate to the path of the folder where you extracted the zip file.


Once you click Finish, Maven would take some time to download all the dependencies and initialize the project.

Quarkus Hello world example

Project Structure:


Quarkus JAX-RX endpoint

package org.knf.dev.demo;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class GreetingResource {

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello RESTEasy";
}
}

Testing

Build application  jar file: mvn clean package
Start application: java -jar quarkus-run.jar
Open the browser and hit the endpoint localhost:8080/api/hello
 
 

Comments

Popular posts from this blog

Spring Boot OpenAI Integration: Step-by-Step Guide

Orchestration-Based Saga Architecture and Spring Boot Microservices Implementation Guide

Spring Boot 3 + Angular 15 + Material - Full Stack CRUD Application Example