Technology: JHipster is the basic code creationtool for Java applications utilizing spring and Spring Integration frameworksand AngularJS.
It alsoprovides the way easier way to develop new features, deploy the applications onthe various application servers and also on Service Registry like Eureka Serverfor service discovery.
It ismajorly used for developing Micro-services using Spring Boot and angularJS.
Itprovides high performance, failure tolerance, cluster-based applications withspring boot, and robust Java-based frameworks.
It usesa modern front end using angular js, bootstrap frameworks which will work forany devices like Mobile, Tablet, and laptop of various monitor sizes.
It willkeep up modern make tools like Maven, Gradle.
It alsosupports workflow management systems like Yeoman, Gulp/Webpack.
Installation: JHipster is dependent upon the below tools/software.
Java,NodeJS, NodeJS plugins like Yarn, Yeoman, and if we want to use angular js 1. xversion we want to install Bower and gulp plugins for NodeJS.
MajorFunctionalities support by JHipster:
• Create a full-stack application, with moreoptions
• Create CRUD entities, directly or byscaffolding
• Database migrations with Liquibase
• NoSQL databases support (Cassandra,MongoDB)
• Elasticsearch support
• Websockets support (using SockJS)
• Automatic deployment to CloudFoundry,Heroku, OpenShift
Why we use JHipser: JHipsterwill focus on generating high-quality code using extensive set springtechnologies Spring Boot, Spring Security, Spring Data(JPA).JHipster creates afully configured spring boot application with a set of predefined screens foruser management, monitoring, and logging.
JHipster offers the tools to update, control and package theresulting application. Run mvn package -Prod to trigger a Maven build that usesthe Spring Boot Maven plugin to create a single executable .war file, and Grunt or Gulp.js tasks to examine, minify and improve JavaScript, HTML, and CSS code.
Installing JHipser:
· We need to install Java( Java 8 will be the preferable version)
· Install NodeJS (download and install from https://nodejs.org/dist/v6.11.2/node-v6.11.2-x64.msi linkmay be depending on windows OS Type.)
· Install Yeoman NodeJS globally using npm install -g yo
· For AnularJS 1. x versions
1. Install bower using install Bower: npm install -g bower
2. Install Gulp: npminstall -g gulp-cli (If you have previously installed a version of gulpglobally, run npmrm -g gulp to make sure your old version doesn’t collide withgulp-cli)
· Install JHipsterNodeJS using npm install -g generator-jhipster globallyso that jhipster command will available on the path.
Generating an Application: Navigate to the folder where we wish to generate the application and runjhipster command, it will ask different questions depending on our inputparameters it will generate the source code properly.
After creating the application we can run the command mvnw (ifwe are using Maven) or gradlew (if we are using Gradle) then the applicationwill start deploying and it will available on http://localhost:8080
It also includes spring developer tools for hot deployment(whenever we save any file it will re-deploying the application in minimaltime).
If any of the front- end related pages are modified, the browserpage will auto- reload using the lifereload server, we can start the server either using gulp (for angular 1.x version) or using yarn start. Chrome provides a plugin for live reloadserver, using a plugin we need to connect to the server so that any changes thatoccur in the front end pages page will auto-refreshes.
Creating Entities onDemand: Once we have created the application, we may need someenhancements/ creating some more entities on requirement basis.
Creating an entity will need:
· Database Table
· Liquibase Change set
· A JPA Entity
· Optional Mapper classes (for mapping DTO to entity classes)
· Spring Data Repository(interacting with created table)
· Spring Rest MVC controller, service (for all CRUD applications)
· Angular JS router, controller, service, component
· HTML files
· Implementation test so that all thing works as needed
· Performance tests
If we have a relationship with other entities, foreign key(s)need to create for the relationship, javascript and HTML files need to modifyto maintain the relationship in UI pages.
We can create entities in different ways either we can useJHipster UML, which allows you to use a UML editor or JDL Studio, our onlinetool to create entities and relationships using our domain-specific languageJDL, we can also use the command line tool to create the entity.
Creating entities usingJDL Studio:
Navigate to https://jhipster.github.io/jdl-studio/ tocreate jdl file, we can specify the all entity’s structure and we can downloadjdl file.
We can run command to generate entities: jhipster import-jdl
Creating entities usingJHipster UML: we need to install the jhipster-umlJHipserplugin to use UML.
npm install -g jhipster-uml
Create anuml file using any of your favorite UML Editor, use thebelow command to generate entity files.
jhipster-umlml-file-name>.jh.
Also use command line to generate entities with jhipster entity after executing the command it will ask for diiferent inputslike field name, type etc…
Possible Fields Types inJHipster:
· String: A Java String. Its fixed size rely on the underlyingbackend (if you use JPA, it’s 255 by default), but you may exchange it usingthe validation rules
· Integer: Java Integer type
· Long: Java Long Type
· Float: Java Float Type
· Double: Java Double Type
· BigDecimal: java.math.BigDecimal object
· LocalDate: A java.time.LocalDate object
· Instant: A java.time.Instant object
· ZonedDateTime: A java.time.ZonedDateTime object, utilized torepresent a local date-time in a given timezone
· Boolean: A Java Boolean.
· Enumeration: A Java Enumeration object
· Blob: A Blob object, utilized to store binary data.
· CLOB (long text). Images will be handled especially on theAngular side.
Validations: Validationmay be set up for all fields. Depending on the field type, various validationoptions will be available.
Validations will be generated at HTML view utilizing Angular JS,server-side using Bean Validation API (spring @Valid annotation), and also at theentity level (Hibernate/JPA (entities are automatically validated before beingsaved)).
Validation data will also be utilized to create more precisedatabase column metadata:
Required fields will be marked non-nullable.
Fields that have a more length will have the same column length.
Pagination:
JHipster will also give the support for pagination if we specificallyat entity generation time.
JHipster provides 4 types of paginations:
1. No pagination (in that case, the back-end won’t be paginated)
2. A simple pager, based on the Bootstrap pager
3. A complete pagination system, based on the Bootstrap paginationcomponent
4. An infinite scroll system, based on the infinite scrolldirective
JHipster gives pagination utilizing Spring Data Pageableinterface.
Internationalizationusing JHipser: JHipster gives labels that can be internationalized based oninputs given. JHipster will generate a srcmainwebappi18n folder labels, it willcreate a JSON for all entities, we can copy the JSON we can generate the labelsfor various languages.
Monitoring JHipsterApplications:
For monoliths and gateways, JHipster creates various dashboardsto monitor all applications. Those dashboards are accessible at runtime and arethe simplest way to do some easy monitoring.
The metrics dashboard: The metrics dashboard utilize Dropwizard metrics to give a detailed view of the application performance.
It gives metrics on:
- JVM
- HTTP requests
- methods used in Spring Beans (using the @Timed annotation)
- database connection pool
The health dashboard: The health dashboard uses Spring Boot Actuator’s health endpoint to give health information on various parts of the application.
The logs dashboard: The logs dashboard permits to manage at runtime the Logback configuration of the running application. Changing the log level of a Java package is as simple as clicking on a button, that is very appropriate both in development and in production.
Conclusion: JHipster the Source code generation which create using cutting edge technologies with better code quality and it provides test coverage, and also generates the performances test case. Based on inputs to JHiptser, java development outsourcing team can easily develop production based applications which easily grow to any size, fault tolerance, etc.