Microservices and Java 9: New Features
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.
Join the DZone community and get the full member experience.Join For Free
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 the
CompletableFuture 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: $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.
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!
Published at DZone with permission of Andre Luis de Oliveira Dias , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.