BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Contribute

Topics

Choose your language

InfoQ Homepage News What's New in MicroProfile 5.0

What's New in MicroProfile 5.0

This item in japanese

Lire ce contenu en français

Bookmarks

Delivered under the auspices of the MicroProfile Working Group and five months after the release of MicroProfile 4.1, the anticipated release of MicroProfile 5.0 was made available to the Java community. This new release features alignment with Jakarta EE 9.1 and updates to all eight community-developed core APIs plus one standalone API:

The CDI, JAX-RS, JSON-P and JSON-B APIs, originally based on their equivalent JSRs, are now based on their equivalent Jakarta EE 9.1 specifications, namely Jakarta Contexts and Dependency Injection 3.0 (CDI), Jakarta RESTful Web Services 3.0 (JAX-RS), Jakarta JSON Processing 2.0 (JSON-P) and Jakarta JSON Binding 2.0 (JSON-B). Behind the scenes, MicroProfile 5.0 utilizes Jakarta Annotations 2.0, a specification that "defines a collection of annotations representing common semantic concepts that enable a declarative style of programming that applies across a variety of Java technologies."

All eight community-developed APIs have been updated to use the Jakarta EE 9 dependencies. As such, there are breaking changes to all of them. We examine a few of the updated APIs here.

MicroProfile Config 3.0

The MicroProfile Config API provides runtime configuration from external sources to minimize repackaging of an application. Based on a priority-based ordinal system, these sources include: system properties (ordinal = 400); environmental variables (ordinal = 300); and a .properties file (ordinal = 100). Priority is given to the highest defined ordinal value. Custom sources may also be defined by implementing the ConfigSource interface.

The only breaking change for Config 3.0 is that it cannot be used with earlier versions of Jakarta EE or Java EE due to the migration of the javax namespace to the jakarta namespace. Other updates include: a clarification in the JavaDoc for the @ConfigProperties annotation; a fix for an inconsistency between the specification and the JavaDoc related to the Converter interface; and a fix for a TCK bug in the ConfigProviderTest class.

MicroProfile Metrics 4.0

The MicroProfile Metrics API provides time series telemetry data for MicroProfile applications. A built-in /metrics endpoint sends data in Prometheus format. Custom metrics may be defined via built-in annotations such as @Counted, @Gauge, @Histogram and @Timed.

Breaking changes in Metrics 4.0 include: an updated Timer class in which Timer.update(long duration, java.util.concurrent.TimeUnit) has been changed to Timer.update(java.time.Duration duration); a MetricRegistry that has been changed from an abstract class to an interface; the Metadata.getDescription() and Metadata.getUnit() methods now return type String instead of Optional<String>; and new methods, Metadata.description() and Metadata.unit(), that return type Optional<String>.

MicroProfile Fault Tolerance 4.0

The MicroProfile Fault Tolerance API provides a number of strategies (timeouts, retries, circuit breakers, etc.) to handle failure within an application. Each of these strategies has a corresponding annotation that, when applied, will redirect the application with a necessary course of action to minimize the adverse effects of a failure.

Breaking changes in Fault Tolerance 4.0 are mainly related to its interaction with the Metrics API. This specification now supports the metric tags that were introduced in Metrics 2.0. And for consistency with other MicroProfile APIs, the application: scope has been replaced by the base: scope. This means that Fault Tolerance metrics are exported via the /metrics/base endpoint replacing the previously used /metrics/application endpoint.

Introduced at Red Hat's DevNation conference on June 27, 2016, the MicroProfile initiative was created as a collaboration of vendors to deliver microservices for enterprise Java. The release of MicroProfile 1.0, announced at JavaOne 2016, consisted of three JSR-based APIs considered minimal for creating microservices: JSR-346 - Contexts and Dependency Injection (CDI); JSR-353 - Java API for JSON Processing (JSON-P); and JSR-339 - Java API for RESTful Web Services (JAX-RS).

MicroProfile 4.0, released in December 2020, was the first version delivered under the then newly-formed MicroProfile Working Group, established in October 2020. Current members of the working group include Oracle, IBM, Red Hat, Tomitribe, Fujitsu, Atlanta Java User Group, Garden State Java User Group and iJUG.

The MicroProfile Working Group is currently evaluating OpenTelemetry, a project formed by the merger of the OpenTracing and OpenCensus projects, and the Micrometer project, a vendor-neutral application metrics facade, as potential candidates to replace the OpenTracing and Metrics APIs, respectively.

Editor’s Note

Michael Redlich is a co-director of the Garden State Java User Group, a contributing member of the MicroProfile Working Group.

About the Author

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT