4. 3 Lab 1: Hello World MicroProfile
In this first lab, we will create a simple Hello World MicroProfile application using Helidon.
The goal is to quickly bootstrap a project that we will later extend with DDD tactical patterns.
4.1 Step 1: Access the Helidon Project Starter
Open the official Helidon starter in your browser:
4.2 Step 2: Select the Helidon Flavor
On the first screen, select Helidon MP as the project flavor, then click Next.
4.3 Step 3: Choose the Application Type
On the "Select an Application Type" step, choose Quickstart, then click Next.
4.4 Step 4: Choose the JSON Library
On the "Select a JSON Library" step, select JSON-B, then click Next.
4.5 Step 5: Customize the Project
Fill in the project details as follows:
- Group Id:
com.example
- Artifact Id:
ecommerce
- Version:
1.0.0
- Package:
com.example.ecommerce
4.6 Step 6: Download the Project
Click on Download to generate and download your starter project.
4.7 Step 7: Explore the Project
After downloading the project, unzip it and open it in your favorite IDE.
4.8 Step 8: Update the port number
Open the src/main/resources/microprofile-config.properties
file change the server.port
property to 8181
.
4.9 Step 9: Run the Application
With JDK21 execute the following commands:
4.10 Step 10: Test the Application
curl -X GET http://localhost:8181/greet
{"message":"Hello World!"}
curl -X GET http://localhost:8181/greet/Joe
{"message":"Hello Joe!"}
curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http://localhost:8181/greet/greeting
curl -X GET http://localhost:8181/greet/Jose
{"message":"Hola Jose!"}