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

Spring boot video streaming example-HTML5

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

Spring Boot + Mockito simple application with 100% code coverage

Spring Boot + OpenCSV Export Data to CSV Example

Custom Exception Handling in Quarkus REST API

DataTable-Pagination example with Spring boot, jQuery and ajax

Registration and Login with Spring Boot + Spring Security + Thymeleaf

Node JS mini projects with source code - free download

Spring boot web project free download:User Registration System

Java - Blowfish Encryption and decryption Example