Relationship between Payara Platform, MicroProfile and Java EE/Jakarta EE

Maybe you've already heard about Eclipse MicroProfile, or maybe you don't know what benefits it offers you in your current project. Perhaps you don't see the relationship with Java EE/Jakarta EE - or how you can use it with Payara Server or Payara Micro.

In this blog, I'll give you a short overview of all of the above questions so that you can start using MicroProfile in your next project on the Payara Platform.

What is MicroProfile?

Starting when Oracle was not clear about their plans for Java EE 8, in a period of time where the term "cloud-native" became a reality since Netflix finished their first large-scale migration, it was an appropriate time for launching a new initiative.

The main goal of MicroProfile is "Optimizing Enterprise Java for a Microservices Architecture". It does this by building on top of a few Java EE specifications, namely CDI, JAX-RS and JSON (JSON-B and JSON-P), some standardized specifications which are common in a microservice architecture.

The main differences with Java EE are that the initiative is entirely open-source, hosted by the Eclipse Foundation, there is no reference implementation but is supported by many vendors, each having their compatible implementation, fast-paced with several releases a year and breaking changes can occur.

For the moment, the umbrella spec (similar to what Java EE is) contains the following specifications:

Configuration - Externalize and manage your configuration parameters outside your micro-services.

Fault Tolerance - All about bulkheads, timeouts, circuit breakers, retries, etc.

JWT Propagation - Propagate security across your micro-services.

Metrics - Gather and create operational and business measurements.

Health Checks - Verify the health of your micro-services.

Open API - Generate OpenAPI-compliant API documentation.

Open Tracing - Trace the flow of requests as they traverse your micro-services.

Rest Client - Invoke RESTful services in a type-safe manner.

You can have a look at the website and read more on each of the individual specifications on the GitHub repositories.

How do I Use MicroProfile with Payara Platform?

Using MicroProfile with Payara Server and Payara Micro is very simple. Since both the Payara Platform runtimes are MicroProfile compliant, they have all the necessary dependencies on board to run your MicroProfile application.

You only need to include the MicroProfile API POM into your maven project:

<dependency>
  <groupId>org.eclipse.microprofile</groupId>
  <artifactId>microprofile</artifactId>
  <version>2.2</version>
  <type>pom</type>
  <scope>provided</scope>
</dependency>

and you have access to all MicroProfile constructs. As you can see, it is very similar to bringing the Java EE dependencies in your project.

This is in contrast with some other runtimes where you need to define each specification separately and add a specification implementation to your application before you can use it.

This way, you can use the concepts you are familiar with from Java EE and gradually include the features of MicroProfile in your project. Since they are all included within Payara Server and Payara Micro, you can just start using them without worrying about how they need to be 'accessed' or 'configured'.

Why Should I Use MicroProfile with Payara Platform?

Payara Server and Payara Micro are just two of the many compatible runtimes, but there are some good reasons for using the Payara Platform with MicroProfile, including:

  • The implementation of the MicroProfile specification is done in a Payara-specific way. This will guarantee faster execution and also we can achieve deep integration with other parts of the product (keep reading to learn about extensions we have.)
  • It combines the Jakarta EE and MicroProfile specifications in a seamless way so that you just can choose what to use and in which combination for your specific project.
  • You can build an executable jar of your application but for cloud environments, the hollow jar approach of Payara Micro gives you a much more efficient structured Container image.
  • There are several extensions to the MicroProfile specifications implemented within Payara
  • Payara has several additional MicroProfile Config sources so that you can define configuration values through the Payara Web console or asadmin commands at different levels (for example, server-wide or application-specific).
  • The OpenTracing information is used by the monitoring service to detect and report slow response to a request.
  • The OpenTracing is extended to Servlet and JAX-WS calls.
  • JWT propagation is deeply integrated into the security system of the Java EE system. This means that JWT tokens also can be used for authentication and authorization of requests within the Java EE / Jakarta EE area.
  • The deployment status of your applications are integrated within the Health endpoints and can be used in cloud environments to detect the readiness of your application, also with Health 1.0.
  • Support for 'namespaces' within the JWT claims so that some additional sources, like Auth0 can be used as a token provider.
  • Export some of the JMX bean values as Metrics through a configuration file.

Does MicroProfile Replace Java EE/Jakarta EE?

Since the development of MicroProfile started when the innovations into Java EE slowed down, one can ask the question if it replaces or will replace Java EE or Jakarta EE?

The answer to this question is very clear, no! As already mentioned, some of the basic building blocks of MicroProfile are some Java EE specifications. So you can see it more as the 'micro profile' of Java EE. Although not officially, it is a grouping of frameworks that you use very often together when you create microservices.

With the transition of Java EE to Jakarta EE, it will become easier to innovate within Jakarta EE as it is now a completely open-source product. There are already voices that propose to merge MicroProfile into Jakarta EE. So it could become a 'Jakarta EE micro profile' but that is something that only the future knows at this moment as there are some hurdles to take (like differences in backward compatibility, number of releases, and project governance, for starters).

MicroProfile will not replace Jakarta EE but it will certainly be a companion in many projects where you combine Jakarta EE and MicroProfile. This is already the case today since you can, in most runtimes, such as the Payara Platform, combine it with other specifications like JPA when you need to access a database, or JMS when using Message Queues.

Payara Platform with MicroProfile Makes Microservices Easier

With MicroProfile, you have some additional tools in your box to make it even easier to create your microservices based on Java EE or Jakarta EE.

Payara Server and Payara Micro have all the code for implementing the MicroProfile specifications already on board. You just need to include the API in your project and you can enjoy the deep integration within the server or runtime without the need for any other configuration.

This makes it easy for the developer to gradually include more features of MicroProfile in their application or make use of the extensions we have foreseen.

About the Author

Rudy De Busscher

Rudy De Busscher

Service Team Member
Payara