Application generation

First, let's see how we can generate a microservices application. In the e-commerce-app folder, create a new folder where you will keep the microservices application. Let's name the folder invoice. Go into the directory and start creating the application by typing jhipster.

The first question we are asked is to select the type of application we would like to create. We have to choose Microservice application and then click Enter:

Then, you need to give a base name to your application. We will go with the default application name, invoice (by default, JHipster selects a folder name the same as the application name):

Then, we will select the default port in which the application has to run. By default, JHipster prompts 8081 as the default port for microservices, since we use 8080 for the gateway application:

Then, we will select the default package name:

Since we have selected JHipster Registry for the gateway application, we will select the same here. Similarly, if we selected Consul for the gateway application, then we can select Consul. We can even choose to have no registry and then add any custom registry there:

Then, JHipster asks for the type of authentication that we would like to use. We will select JWT authentication, the same as we have selected for the gateway application:

Then, select the type of database that we need to have. As highlighted, the invoice service will have the SQL database. We will select the SQL option. JHipster provides an option to opt out of the database itself. When No database is selected, the application is generated with no database connection:

We will select the production database as MySQL

We will then select the development database as H2 with disk-based persistence:

Then, we will select HazelCast cache as the Spring cache abstraction. Hazelcast provides a shared cache among all sessions. It is possible to hold the persistent data across the cluster or at the JVM level. We can have different modes available, with single or multiple nodes. 

Ehcache is a local cache and it is useful for storing information in a single node. Infinispan and HazelCast are capable of creating a cluster and sharing information among multiple nodes, with HazelCast using a distributed cache, each of them connected together. On the other hand, Inifinispan is a hybrid cache:

Then, we will choose Hibernate 2nd level cache:

We will select Gradle for the build tool:

Then, JHipster asks whether we have any other technologies that we would like to add. We will not select anything here and go with the default option:

Then, we will opt to have internationalization (i18n):

And then, we will select English as the default option:

And select the additional languages that we need:

Then, select any other testing frameworks that we would like to add to Gatling or Cucumber. Note that since it will not generate a frontend application, options such as Protractor are not listed:

Finally, we will select any other generators that we need to install from the JHipster marketplace. Currently, we will not select any other generators (default option):

Then, the server application is generated:

Our microservice application is generated. JHipster will automatically commit the generated files to Git. If you wish to do this step yourself, you can do so by passing the skip-git flag during execution, for example, jhipster --skip-git, and executing the steps manually as follows:

> git init
> git add --all
> git commit -am "generated invoice microservice application"