Getting Started With MicroProfile

by Hayri Cicek

Posted on 29-Jul-2018

In this tutorial I'll show you how to get started with MicroProfile.

Tools You Will Need
Maven 3.3+
Your favorite IDE. I'm using NetBeans
JDK 1.8+

Generate Maven Project
In your terminal type the following

$ mvn archetype:generate -DgroupId=com.kodnito -DartifactId=getting-started-with-javaee 
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

This command will generate a new maven project.
Now open the project in your favorite IDE.

Adding Dependencies

Open the pom.xml and change the file to look like this

<project xmlns="" xmlns:xsi=""


We added MicroProfile dependency and the Thorntail ( Maven plugin.

Rest Controller

The maven command generated two files and which we don't need so the first step is to the delete them.

Create a new class inside com.kodnito package as follows

package com.kodnito;


public class RestApplication extends Application {

@ApplicationPath annotation identifies the application path that will serve as the base for all our endpoints.

Now create a new class called HelloResource inside com.kodnito.resources package as follows

package com.kodnito.resources;


public class HelloResource {
    public String hello() {
        return "Hello MicroProfile";

@Path annotation identifies the URI path.
@GET annotation indicates that hello() method responds to HTTP GET requests.

Now it's time to test our new rest endpoint
Open your terminal and go to the project directory.
Run the following command

$ mvn thorntail:run
Now, enter the http://localhost:8080/api/hello in browser's address bar and see the output.

Share this: