What Is Eclipse Microprofile?
December 7, 2021

What Is MicroProfile?

Microservices

Microservices can provide developers a slew of advantages, but they don't come without their challenges. Originating from Java user groups and server vendors, MicroProfile aims to address the limitations of microservices in enterprise Java development.

In this blog, we explore MicroProfile: what it is, why it was created, its future, and using MicroProfile with JRebel. 

Finding a Microservice Framework

With all these online resources, starting the development of a new application couldn't be easier these days — or at least that’s how it seems. When you get started, however, there are many things that need to be decided. For now, let’s put all the questions about frameworks and technologies aside and focus on one of the most important decisions: the architecture of the application. Should you go with a monolith or microservices?

Let’s say you decide on microservices. That's great! Today, they’re very common and much discussed, but you don’t want to start from scratch. Rather, you'll most likely want to start with a reliable solution. One of the available solutions you may consider is MicroProfile.

What Is MicroProfile?

MicroProfile is a a project that provides a collection of specifications designed to help developers build Enterprise Java cloud-native microservices.

Initially released in September 2016, the first version of MicroProfile was formed on JAX-RS, JSON-P, and CDI. While the first two are specifications that provide API, CDI puts everything together. As you can see, these are all components of Java EE. That’s because MicroProfile targets enterprise applications.

Goals of MicroProfile

The main goal of MicroProfile is to define collections of Enterprise Java APIs for the optimal development of cloud-native microservices. These APIs were originally adopted from the Java EE standard (MicroProfile 3.x releases on Java EE 8) and were extended by those that are useful for the microservices pattern. Since the version of MicroProfile 4.0, Java EE was replaced by the Jakarta EE.

Another goal of MicroProfile has been the ongoing addition of implementations and components. For example, MicroProfile is implemented in WildFly SWARM, Open Liberty, Apache TomEE, Thorntail and others. As mentioned above, MicroProfile version 4.0 and onward is based on Jakarta EE, which replaced the role of Java EE. If for some reason you are still dependent on previous Java EE, you can still use older releases.

Notable MicroProfile Features and Functionalities

Its many specifications mean MicroProfile covers the needs of almost every Enterprise Java-focused development. The list is long, including:

  • Health Check
  • Fault Tolerance
  • Metrics
  • Rest Client
  • Open Tracing

Let’s zoom in to talk about the OpenAPI, JWT, and Config specifications.

MicroProfile OpenAPI

Using this specification, developers can use Java API and programming models to produce OpenAPI v3 documents from JAX-RS applications. Recently, this spec was updated to use Jakarta dependencies and new annotations, such as @SchemaProperty and @RequestBodySchema. @APIResponseSchema was also added.

MicroProfile JWT

MicroProfile JSON Web Tokens, or JWT for short, is a specification that allows you to authenticate and authorize requests to a service. The latest stable release added support for JWT Token cookies.

MicroProfile Config

This feature allows configuring applications based on a running environment using data from different sources and different locations. This means you can externalize configuration from microservices. MicroProfile Config is using Jakarta EE 8 dependencies.

Future of MicroProfile

The current stable version, MicroProfile 4.1, was released in July 2021. Major changes against the MicroProfile 3.3 are incremental updates for the following modules:

  • Metrics 3.0
  • Fault Tolerance 3.0
  • Rest Client 2.0
  • Config 2.0
  • Health 3.1

There is active development on the new version as well. At this time of this blog’s release, MicroProfile 5.0-RC2 is available. According to MicroProfile’s release process, this is a major update bringing updates to:

  • MicroProfile Config (3.0-RC5)
  • MicroProfile JWT RBAC (2.0-RC2)
  • MicroProfile OpenAPI 3.0 (3.0-RC5)

Speaking about the future state of MicroProfile, the goal is to “iterate and innovate in short cycles.

To try out MicroProfile 5.0-RC2, just open your pom.xml and add the following dependency:

<dependency>
    <groupId>org.eclipse.microprofile</groupId>
    <artifactId>microprofile</artifactId>
    <version>5.0-RC2</version>
    <type>pom</type>
    <scope>provided</scope>
</dependency>

If you want to start working immediately with MircroProfile, you can visit its “starter” page and generate a runnable MicroProfile project there. The starter page is available here: https://start.microprofile.io/

MicroProfile vs. Spring Boot

Nowadays, development teams who need to break down their monolithic application into microservices (or who just want to start with a new microservices) face a difficult decision: Which framework they should use?

If you search for a Java microservice framework on Google, you’ll find a huge selection, such as Spring Boot, Micronaut, Quarkus, Vert.X, and others. While some of them are older and some of them are newer, they all share the same goal — to provide the best features for microservices development — and they all do it well. Why even bother looking at other microservice framework options when you could just use Spring Boot?

Because alternatives, including MicroProfile-based alternatives, could be a better fit depending on the application.

Let’s now quickly compare MicroProfile vs. Spring Boot.

Spring Boot is objectively one of the most popular Java frameworks for writing microservices and has many extension projects. It’s a mature, open-source, feature-rich framework with excellent documentation and a huge community. Starting with the development is super easy; for example, you can generate an application template using start.spring.io and start the application within minutes. That’s because Spring Boot has an embedded Tomcat server that you can use. But if you don’t want to use Tomcat, you can easily edit the default approach.

MicroProfile, while not as ubiquitous as Spring Boot for microservices applications, still offers unique benefits to certain types of microservices applications. With a cloud-native approach that makes it easier to use within cloud infrastructure, and benefits that make it fault-tolerant, discoverable, and secure, expect to see MicroProfile-based frameworks command more market share as companies continue to go to cloud. 

JRebel and MicroProfile

Our productivity tool, JRebel, works well with implementations of MicroProfile that we support, such as Payara Server, WebSphere Liberty, or WildFly.

To start working with JRebel, you need to enable JRebel for your MicroProfile project.

Image showing how to enable JRebel from MicroProfile

Once you start the server with the JRebel agent attached, you can enjoy skipping the long reload times! A good sign that it's working is a message from the JRebel agent that a specific class was reloaded.

Image of code showing message from the JRebel agent that a specific class was reloaded

Final Thoughts

Consider MicroProfile the next time you need reliable specifications for your next microservice-oriented project. By bringing together many parts of the Java ecosystem in open collaboration, enterprise Java in microservice-based architectures has been optimized for the benefit of all members of the community.

Additional Resources

If you want to learn more about how to improve microservices performance for your Java application, we recommend checking out the resources we have listed below — especially our white paper, The Developer's Guide to Microservices Performance.

DOWNLOAD WHITE PAPER

You may also be interested in our webinar, Improving Performance in Java Microservices. Click "Play" below to start watching on-demand.

Looking for something a little different? Check out our other on-demand webinars and blogs pertaining to microservices below.

For all of our content related to Java microservices, check out our comprehensive guide to Exploring Java Microservices.