A Stack for The Ages – Part 2


In the first part of this series we introduced the basics of JHipster – we scaffolded a basic monolithic Java/Angular application and used JHipster’s command line options to generate some entities, services, and web modules for creating, retrieving, updating and deleting those entities. 

This time around we are going to use JHipster’s JDL Studio to model an inventory system for our imaginary new startup called ‘HipCarz’. After that we’ll also set up an automated build using JHipster’s continuous integration support. 

JDL Studio

The JDL (JHipster Domain Language) is a simple language with a friendly syntax that we can use to:

  • – Declare applications with their options and entities 
  • – Declare entities with their attributes, and validations 
  • – Declare the relationships between them, 
  • – And declare some JHipster specific options 

JDL can even be used to scaffold a multi micro-service arrangement with gateway. 

JDL Studio is available free to use at https://start.jhipster.tech/jdl-studio/. Its interface purely gives some visual candy to allow us to see an ERD style diagram.

Below is the code we will paste into the studio (full options are here https://www.jhipster.tech/jdl/#-jdl-sample

application {
config {
baseName hipcarz
packageName com.hipcarz
applicationType monolith
databaseType sql
devDatabaseType h2Disk
prodDatabaseType mysql
cacheProvider ehcache
enableHibernateCache true
authenticationType jwt
clientFramework angularX // will use Angular 8
useSass false
clientPackageManager npm
enableTranslation true
languages [ en, zh-cn, es ]
messageBroker false
searchEngine elasticsearch
serverPort 8080
websocket false
testFrameworks [protractor, cucumber, gatling]
buildTool gradle
entities *
entity Make {
name String required unique maxlength(20),
desc String
entity InventoryModel {
name String required unique maxlength(20),
vehicleType VehicleType
desc String
enum VehicleType {
entity Inventory {
vin String required unique maxlength(17),
year Integer min(1900) max(2050),
color String,
comment String maxlength(128)
relationship ManyToOne {
InventoryModel{make(name) required} to Make,
Inventory{inventoryModel(name) required} to InventoryModel
/* instructs JHipster to use DTOs to wrap all entities */
dto * with mapstruct

/* use pager, pagination, infinite-scroll pagintion */
paginate * with pagination

/* use serviceClass or serviceImpl */
service * with serviceClass

/* generate search engine capabilities */
search * with elasticsearch

/* enable filtering for the attributes of each entity, so the server can be used more effectively by any client - and any browser */
filter *

JHipster Studio updates on the fly with an ERD Diagram as we type:

Download the text file version of the JDL from the options in the top right and use it to execute the following command from a new hipcarz directory you have created in your file system: 

jhipster import-jdl hipcarz.jh 

This will generate the Spring Boot application itself, scaffold the rest endpoints, validation, entities, services, the Angular 8 front end SPA and modules (plus unit tests, Swagger, i18n etc. etc.  as mentioned before) Now start the application with the included Gradle wrapper: 


Access at localhost:8080 and sign in with the default admin/admin combo and create some entities:

Create some entities:

maybe the exact look and feel that we want right now, but a great infrastructural starting point. 

And we got Swagger for our apis too (notice the elasticsearch’able searchInventories and filterable getAllInventories operations ): 

Automated Builds 

It’s always nice to have automated builds in place whenever new changes are pushed. 

Setting up Continuous Integration (CI) for a JHipster application is harder than for a classic typical Spring MVC application because of the complexity associated with maintaining a build composed of 2 software stacks: 

  • – the Java back-end code with Maven or Gradle  
  • – the JavaScript front-end with NodeJS, NPM or Yarn

JHipster has support for Jenkins pipeline, Azure Pipelines, GitLab CI and Travis CI. 

Let’s generate a GitLab CI pipeline using ‘jhipster ci-cd’ command : 

We’ll omit deployment options for now.. 

we now have a .gitlab-ci.yml file in our top level

Let’s create a Gitab repository and push up everything: 

Because we have pushed the .gitlab-ci.yml, this will trigger a CI pipeline job on every git push: 

The pipeline consists of several jobs specified in gitlab-ci.yml: 

Each ‘passed’ job is clickable where build artifacts, unit test and code coverage reports can be downloaded 🙂

That’s all for now, join us in the next part of this series where we will discuss deployment options, JHipster’s micro-service options as well as the JHipster Marketplace. 

Some more reading/viewing: