Friday, September 23, 2016

Kick-Off Java 9 (Project Jigsaw) Part - I

Now a day's monolithic applications comes into micro batches. Every micro batch independent from each others and deploy. Now the Java will come in this flavor using project Jigsaw

Java 9 comes with great feature call "Jigsaw", which modularize monolithic Java code into modules. Where we design independently standard modules with in different scopes. Primary goal of "jigsaw" to make scalability, maintainability, performance, security etc. For more information please click on this link.

Today we creating just a greeting example using project "Jigsaw" or modularize our code independently.

Prerequisite


Step - I

Create a source directory for our source code:
$ mkdir -p jigsaw-sample1/src

Step - II

Categories our system into modules like in this example, i have one utility module and other main module. The utility module contains utility classes and main module access that utility class and their methods for performing operations.
jigsaw-sample1/src $ mkdir com.knoldus.util com.knoldus.main
Before jigsaw, we module our project using packages but still we have monolithic structure. Our package conventions is reverse domain of company. Jigsaw still recommend that convention.

From above command we are creating two directories, which is basically our project modularization. These are two independent modules and for packaging, two independent jar. which we will see later.