Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Microservices and Java 9: New Features

DZone's Guide to

Microservices and Java 9: New Features

This article highlights the most important features added to Java and their applicability to create excellent Microservices solutions with Java 9.

Free Resource

How do you break a Monolith into Microservices at Scale? This ebook shows strategies and techniques for building scalable and resilient microservices.

Some weeks ago, the newest Java version was officially released. During the most important event promoted by Oracle, at JavaOne, all the new Java features and other topics were presented to the communities and enterprises in order to foster the usage and exploration of the new capabilities added to it.

Below, we selected some of the features that could help the implementation of microservices solutions — with the advent of newer containers and other language approaches that could bring quality and accelerate the development and performance of distributed systems.

So, let’s get started.

REPL: JShell (JEP 222)

REPL stands for Read-Eval-Print-Loop. The purpose of this is to accomplish easy test tasks in a specific codebase portion without the need to deploy the whole solution and then debug the desired source code.

In the new Java version, this approach was incorporated within the JDK, by the name of JShell (JEP 222). The good part is that now you can test your microservices without the need to deploy them over and over, accelerating the development, evolution, and quality of the final components.

Concurrency Updates (JEP 266)

This interesting feature is the reactive programming movement's effort formalization for Java language. These updates include an interoperable publish-subscribe framework, enhancements to theCompletableFuture API, and various other improvements incorporated into the Java language, according to the official site.

This way, we can implement Reactive microservices in Java using this important update in Java 9!

Enhanced Deprecation (JEP 277)

This feature helps developers and systems alike to understand more about the deprecation of a specific API in an easy and seamless way. This could support the contract evolution of the exposed services.

For more information, please check the JEP.

New Version String Format (JEP 223)

Semantic versioning is the message here. In the new Java version, a new version scheme was defined as described below:

Major.Minor.Security.Patch, where:

  • Major: $MAJOR version, when you make incompatible API changes.

  • Minor: $MINOR version, when you add functionality in a backward-compatible manner.

  • Security: $SECURITY version, when you add security-critical fixes, including those necessary to improve security functionality or make backward-compatible bug fixes.

  • Patch: $PATCH version, when you make backward-compatible bug fixes.

With microservices projects, this feature could foster a new way to control the versioning and evolution of projects and solutions — with a clear view of what’s inside of it when this pattern is rigorously followed.

The Best Part: Modularity (JEP 261)

Now Java 9 has modularity. This means that we can create modular applications without needing to import things we don’t need and compile things that we don’t use for that specific piece of code.

The JDK and JRE runtime images were restructured to accommodate modules and to improve performance, security, and maintainability. A new URI scheme was defined for naming the modules, classes, and resources stored in a runtime image without revealing the internal structure or format of the image.

In the microservices arena, this represents an excellent effort to:

  • Create a specific codebase for microservices
  • Better test our microservices
  • Deliver microservices

For more information, please check the official page.

In Summary

All in all, the Java community is working hard to accomplish and realize the best ideas and needed changes in Java in order to address the continuous business demands of our customers using the solid microservices architectural approach.

Thanks for reading!

How do you break a Monolith into Microservices at Scale? This ebook shows strategies and techniques for building scalable and resilient microservices.

Topics:
microservices ,java 9 ,java ,modularity

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}