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
 
 

Popular posts from this blog

Learn Java 8 streams with an example - print odd/even numbers from Array and List

Java Stream API - How to convert List of objects to another List of objects using Java streams?

Registration and Login with Spring Boot + Spring Security + Thymeleaf

Java, Spring Boot Mini Project - Library Management System - Download

ReactJS, Spring Boot JWT Authentication Example

Spring Boot + Mockito simple application with 100% code coverage

Top 5 Java ORM tools - 2024

Java - Blowfish Encryption and decryption Example

Spring boot video streaming example-HTML5

Google Cloud Storage + Spring Boot - File Upload, Download, and Delete