Lightning Fast Zero to Production with Spring, Neo4j and jHipster
1. 1
Lightning fast Zero to Production
with Spring, Neo4j and jHipster
Giuseppe Villani
Davide Fantuzzi
#NODES2020
20th October, 2020
2. Who we are - LARUS Business Automation
● Founded in 2004 (Venice)
● Specialized in the design and implementation of large-
scale business solutions
● Neo4j Partner and Training Center
4. JHipster is a development platform to generate, develop
and deploy Spring Boot applications and microservices in
few steps.
Recently has added Neo4j to supported db.
6. ● Easy to install and create entity
● A stable back-end and front-end architecture
● Support for deployment
● Multiple choice of testing frameworks and technologies
● Extendable
8. Main server-side technologies (excluding plugins)
● Spring Boot with Spring MVC + Jackson
● Spring Data JPA
● Spring Security
● Netflix Oss (for microservices)
● JUnit
● And more...
24. When the entity is created, JHipster generates:
● A Spring MVC Rest Controller with the basic CRUD
operation
● The related Spring Service (if needed)
● A JPA Entity and Spring Data Repository
● The front-end modules:
○ Routes, components and service / reducer
● Integration and performance tests
25. You can just create a Controller or Service
● jhipster spring-controller[controllerName]
● jhipster spring-service[serviceName]
29. Modules
To extends common functionalities from JHipster
● Ionic
● Angular Material
● Kutilang
● Ignite-jhipster
● Primeng
Visit the Marketplace for a complete list ;)
31. JHipster supports different types of deploy
For example: jhipster heroku
● Package the application in production mode
● Create an Heroku application with the db
● Upload the code
● Start the application
Hi everyone, I am giuseppe villani. Software developer at larus. in this talk I will speak about how to create a full stack application with Neo4j and Jhipster
First of all, let me introduce my company.
Larus business automations is a software house
founded in 2004(tuenti o four) and based in Venice
It is specialized in the design and implementation of large-scale and customized business solutions.
One of the strong points of Larus is to be the number one solution partner of Neo4j in italy
and the Italian Neo4j Authorized Training Center.
Now here’s what we will see in this talk.
First, why choose JHipster.
Then how to install it.
How to create entities within our project.
How to extend the functionality of jhipster.
The deployment process. And of course how it has been integrated with neo4j.
Finally a live coding session with my colleague davide.
in a nutshell JHipster is a development platform to generate,
develop and distribute Spring Boot applications and microservices in a few steps.
JHipster added neo4j to supported databases only in newer versions.
So, why install it?
Surely because it facilitates the developer's work in the initial installation of the application
that you want to create, as well as the creation of the single entities that populate it.
Offers a stable and robust full-stack environment.
It allows you to create a stable application
without knowing in depth all the best practices behind it,
because it's Jhipster who applies them in our place.
Moreover, simplifies the application deployment process by supporting many platforms.
It also offers a wide range of testing frameworks.
By default it supports Junit for backend and Jest for frontend testing,
but you can optionally choose others besides these two.
And, regarding the frontend, you can choose between Angular and React
Is't already configured, optionally, for translations.
Moreover it's integrated Sonar for code quality.
besides, There are a lot of useful tools and additional components.
So, let’s see the front-end technology base stack.
JHipster uses webpack to compiles, minifies code
Browsersync to Automatically refresh the browser when code is modified
Jest as testing framework
Other optional technologies available during installation.
1 min -
Netflix open source software to create microservices
And also in this case Other optional technologies available during installation process or by plugins
After the installation process, many tools and components are also added.
First of all JHipster comes with 4 different users (that is admin, user, system and anonymous) with different roles configured
That is a complete user management system automatically generated when I install Jhipster.
Lista dei tool:
In addition, several administration dashboards are added.
We can found Health Checks to check the status of db,
to verify that the app is running correctly and that there aren't memory problems.
Moreover, we can find a dashboard with all docker configurations and environment variables used.
Lista dei tool:
And also we have a metric dashboard which allows you to have a detailed view of the application performance on the JVM,
HTTP request and cache usage.
As well as a list of the APIs used
So let's see how to install it.
First of all, is to be specified that JHipster is not a framework per se.
Instead is a Yoman application generator.
Yomen an open source scaffolding tool for web applications that runs as a command-line interface written for Node.js
There is 3 ways to install JHipster.
The most classic and used is through installation with package npm. Alternatively it can be installed with Yarn.
otherwise you can decide to install one of the several docker images that JHipster provides in Docker HUB.
And finally, you can choose to try JHipster directly online. This is useful if you want to try its potential without having to download it
So, to install JHipster with most common way, just download the npm package,
go to the installation folder and start jhipster.
So, just answer the various questions it asks.
In general, to create a fully functional application, you can just choose the application name and Neo4j as db,
and mark all other questions with default answer.
But let's see in depth the possible choices of the application.
First of all, we can choose if our application will be monolithic,
with all the backend and frontend functionalities together.
Or a microservice application, or again a microservice gateway.
or we can choose a JHipster JHipster User Account and Authentication server
that is a service for securing JHipster microservices using the OAuth2 authorization protocol.
This is similar to Cloudfoundry UAA
We can add optionally JHipster registry to your application,
this is a registy service based on Spring Cloud Netflix, Eureka and Spring Cloud Config.
It mostly provides the same admin dashboards seen in the previous section, but it works on a separate server
Moreover we can choose which type of Authentication to use.
Then we can choose whether to integrate the Spring Webflux web framework
If implements or not Spring cache abstraction that allows consistent use of various caching methods,
with different choices
And we have the possibility to use Maven or Gradle to build the backend
And we can shoose other useful technologies already configured:
That is WebSocket. ??
Apache Kafka. ??
OpenAPI generator ??
We can choose the default language and others languages to set up the application translation ready.
And We can also decide to create an application with only the backend.
So, it's possible to add other testing frameworks,
like Protractor as a frontend framework, or Gatling for performance tests.
A cucumber for test based on Behavior Driven Development methodology
Also, we can choose from numerous default themes for our frontend.
And it's done.
Now we can start the application and we will get this initial screen.
So as we can see, we have a multitude of options to choose from.
With the installation of JHipster, we already have two Spring Profiles.
dev for development focuses on ease of development and productivity
and prod for production focuses on performance and scalability
Now let's see the creation of the individual entities.
To create an entity, just type jhipster entity followed by the entity name.
At this point, similarly for the installation process, a serie of questions will follow
to explain to JHipster how to install the entity.
But, If you need to create more entities in one shot, JHipster has 2 useful tool, Jhipster UML and JDL studio,
We will see it later, during the live coding session.
When I create an entity
jhipster automatically creates for us, the Spring controller with the basic crud operation.
The related Spring Service, if needed by entity, and the associated Repository.
Moreover, JHipster creates the set of modules needed for the frontend,
and the html views with the routes and the calls to the api
And also, all the associated tests to frontend and backend.
However it is also possible to just create a service through the command jhipster spring-service followed by the name of entity
or a single controller with command jhipster spring-controller followed by the name.
Here we find an example page generated when I create an entity.
As we can see that the list view is already set up with pagination and sorting.
However, both pagination and sorting are optional during entity creation.
now let's see how it is possible to extend the application created with other features
First of all, JHipster extensions are divided into 2 categories,
blueprint that are a jhipster feature to overwrite specific frontend or backend features and deeply changing the initial code.
And the modules that are add-ons strictly speaking. Principally the modules concern the front-end part.
Both blueprints and modules are, as for JHipster, IOMEN generators.
One of the most important blueprints is Kotlin which changes the code from Java,
same thing if you want to use nodeJs as a backend language.
While for the frontend we find Vuejs, in case you want to replace the present Angular or React
And still others.
Among the most relevant modules, at least personally, there are Ionic Framework for creating cross-platform applications
Angular material to easily replace the view from the default bootstrap.
Flutter to create, like Ionic, a cross platform application by changing the frontend language with Dart.
Kutilang to use Flutter as backend language and create mobile apps for ios and android
Ignite-jhipster instead, also useful in this case for cross platform applications, creates an application based on React-Native.
PrimeNg instead integrates the Angular UI Component Library with an angular application.
There are many others that can be visited on the Jhipster Marketplace.
So, as we have seen, the possible choices of applications are really many.
Now let's see how JHipster facilitates the deployment process.
One of the supported platforms is heroku.
For example, by simply typing jhipster heroku,
jhipster automatically creates a package optimized for production mode.
Create a Heroku application with the database.
Upload the code to the platform.
And start the application.
There are several types of platforms supported with a similar command to facilitate deployment.
These include Docker Hub, Google Cloud Platform, Amazon Web Services and Microsoft Azure.
In addition, Jhipster facilitates the configuration of CI CD system.
To setup your config file for ci/cd just type ... and, as for installation and for entities, you have to answer some questions in the terminal end in a few steps
we have the ci configured
JHipster support the most important CI systems, that is ..
Now let's see how JHipster has been integrated with neo4j.
This implementation was made recenlty, in version 6.8.0 released this March.
JHipster is currently at version 6.10.3
Precisely for this reason, the integration is still in beta,
so some modules and blueprints are missing,
such as Database Backup to make a periodic backup.
Neo4j comes with Spring data ...
Ne
So, with the installation of Jhipster, Spring Data Neo4j / RX is installed,
the successor to Spring Data Neo4j + Neo4j-Object Graph Mapper with full reactive programming support
However, it should be noted that the repository of SDN/RX was set to read-only mode
in favour of Spring Data Neo4j 6.0.
So it is very PLAUSIBOL that this change will also take place in the jhipster in the future
Also a Neo4j TestContainer based on the official Docker image provided by Neo4j, Inc. is installed for unit testing with Junit
And Finally, Neo4j Migration, tool for defining Java based migrations,
to provide a Version control for your database, like flyway db or Liquibase.
And that's all for my part .. Now I give the floor to Davide for live coding session. Thank you.