Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
77 views23 pages

(eBook PDF) Full Stack Development with JHipster: Build modern web applications and microservices with Spring and Angularpdf download

The document promotes an ebook titled 'Full Stack Development with JHipster,' which guides readers in building modern web applications and microservices using Spring and Angular. It includes insights from experienced reviewers and covers various topics such as JHipster setup, application architecture, and deployment strategies. The book aims to streamline the development process and enhance productivity for both novice and experienced developers.

Uploaded by

shalamgicele
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
77 views23 pages

(eBook PDF) Full Stack Development with JHipster: Build modern web applications and microservices with Spring and Angularpdf download

The document promotes an ebook titled 'Full Stack Development with JHipster,' which guides readers in building modern web applications and microservices using Spring and Angular. It includes insights from experienced reviewers and covers various topics such as JHipster setup, application architecture, and deployment strategies. The book aims to streamline the development process and enhance productivity for both novice and experienced developers.

Uploaded by

shalamgicele
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 23

Quick and Easy Ebook Downloads – Start Now at ebookluna.

com for Instant Access

(eBook PDF) Full Stack Development with JHipster:


Build modern web applications and microservices
with Spring and Angular

https://ebookluna.com/product/ebook-pdf-full-stack-
development-with-jhipster-build-modern-web-applications-and-
microservices-with-spring-and-angular/

OR CLICK BUTTON

DOWLOAD EBOOK

Instantly Access and Download Textbook at https://ebookluna.com


About the reviewers
Julien Dubois is the creator and lead developer of JHipster. He has more than 20 years of
experience as a software developer, mainly in Java and Web technologies. He has a strong
knowledge of the Spring Framework, having coauthored a best-selling book on the subject,
and has managed SpringSourcebs France subsidiary.

Today, Julien works as the Chief Innovation Officer at Ippon Technologies, an IT consulting
company that has delivered many JHipster-based applications to its clients worldwide.

I would like to thank my wife, Auralie, and our children, Gabrielle, Adrien, and Alice, for
their patience during the reviewing of this book and the development of JHipster.

Antonio Goncalves is a senior Java developer expert on distributed systems. Despite being
a consultant, he loves to build bonds with the community, so he created the Paris Java User
Group and Devoxx France. As a JCP expert member on various JSRs, Antonio uses this
expertise to write books on Java EE and to talk at international conferences. For his
expertise and all of his work for the Java community, Antonio has been elected Java
Champion. Follow him on Twitter at !BHPODBM.

Packt is searching for authors like you


If you're interested in becoming an author for Packt, please visit BVUIPSTQBDLUQVCDPN and
apply today. We have worked with thousands of developers and tech professionals, just
like you, to help them share their insight with the global tech community. You can make a
general application, apply for a specific hot topic that we are recruiting an author for, or
submit your own idea.
Table of Contents
Preface 1

Chapter 1: Introduction to Modern Web Application Development 8


Modern full-stack web development 9
Web architecture patterns 11
Monolithic web architecture 12
Microservice architecture 15
Choosing the right pattern 18
When to choose a monolithic architecture 18
When to choose a microservice architecture 19
Summary 20
Chapter 2: Getting Started with JHipster 21
Why JHipster? 22
Goal and adoption of JHipster 23
Introduction to technologies available 24
Client-side technologies 24
HTML5 and CSS3 24
HTML5 24
CSS3 25
Sass 25
Bootstrap 25
MVVM framework 26
Angular 26
React 27
Build tools 27
Webpack 27
BrowserSync 28
Testing tools 28
Karma 28
Protractor 28
Internationalization 28
Server-side technologies 29
Spring Framework 29
Table of Contents

Spring Boot 30
Spring Security 30
Spring MVC 31
Spring data 31
Security 31
JWT 31
Session 32
OAuth2 32
Build tools 32
Maven 32
Gradle 33
Hibernate 33
Liquibase 33
Caching 33
Ehcache 34
Hazelcast 34
Infinispan 34
Swagger 34
Thymeleaf 34
Dropwizard metrics 35
WebSocket 35
Kafka 35
Testing frameworks 36
JUnit 36
Gatling 36
Cucumber 36
Introduction to database options 36
SQL databases 37
H2 37
MySQL 37
MariaDB 37
PostgreSQL 37
MS SQL 38
Oracle 38
NoSQL databases 38
MongoDB 38
Cassandra 38
Elasticsearch 39
Installation and setup 39
Prerequisites 39

[ ii ]
Table of Contents

Tools required 40
Installation procedure 40
Java 8 40
Git 41
Node.js 41
Yarn 42
Docker 42
IDE configuration 43
System setup 43
Installation of JHipster 44
Summary 45
Chapter 3: Building Monolithic Web Applications with JHipster 46
Application generation 47
Step 1 – preparing the workspace 47
Step 2 – generating code using JHipster 47
Server-side options 49
Client-side options 53
Internationalization options 54
Testing 55
Modules 56
Code walkthrough 58
File structure 59
Server-side source code 62
Java source 63
Resources 70
client-side source code 70
Starting the application 73
Application modules 74
Home and Login modules 75
Account modules 77
Settings 78
Password 78
Registration 79
Admin module 80
User management 80
Metrics 81
Health 82

[ iii ]
Table of Contents

Configuration 82
Audits 83
Logs 83
API 84
Running generated tests 84
Server-side tests 85
Client-side tests 85
Summary 86
Chapter 4: Entity Modeling with JHipster Domain Language 87
Introduction to JDL 87
DSL grammar for JDL 88
Entity modeling with JDL 88
Relationship management 89
DTO, service, and pagination options 90
JDL Studio 92
Use case entity model with explanation 93
Entities 93
Relationships 96
Options for entities 97
Entity generation with JHipster 99
Generated code walkthrough 100
Server-side source code 102
Domain class for the entity 102
Repository interface for the entity 105
Service class for the entity 105
Resource class for the entity 106
Client side 107
TypeScript model class for the entity 107
Angular services for the entity 107
Angular components of the entity 108
Angular route for the entity 109
Angular module for the entity 110
Generated pages 111
Running generated tests 114
Summary 115
Chapter 5: Customization and Further Development 116
Live reload for development 117

[ iv ]
Table of Contents

Spring Boot DevTools 117


Webpack dev server and BrowserSync 118
Setting up live reload for an application 119
Customizing the Angular frontend for an entity 119
Editing an entity using the JHipster entity sub-generator 129
Changing the look and feel of the application 136
Adding a new i18n language 138
Authorization with Spring Security 140
Limiting access to entities 140
Limiting access to create/edit/delete entities 141
Limiting access to data of other users 142
Summary 145
Chapter 6: Testing and Continuous Integration 146
Fixing and running tests 147
Continuous integration 152
CI/CD tools 153
Jenkins 153
Travis CI 154
GitLab CI 154
CircleCI 154
Setting up Jenkins 155
Creating a Jenkins pipeline using JHipster 155
The Jenkinsfile and its stages 157
Setting up the Jenkinsfile in a Jenkins server 160
Summary 164
Chapter 7: Going into Production 165
An Introduction to Docker 166
Docker containers 166
The Dockerfile 167
The Docker Hub 167
Docker compose 168
Starting the production database with Docker 169
An introduction to Spring profiles 171
Packaging the application for local deployment 172

[v]
Table of Contents

Building and deploying using Docker 172


Building and deploying an executable archive 173
Upgrading to the newest version of JHipster 174
An introduction to deployment options supported by JHipster 178
Heroku 178
Cloud Foundry 179
Amazon Web Services 179
Production deployment to Heroku cloud 179
Summary 182
Chapter 8: Introduction to Microservice Server-Side Technologies 183
Microservice applications versus monoliths 184
Building blocks of a microservice architecture 186
Service registry 187
Service discovery 187
Health check 189
Dynamic routing and resiliency 189
Security 190
Fault tolerance and failover 190
JHipster Registry 191
Netflix Eureka server 191
Spring cloud config server 193
HashiCorp Consul 194
Service discovery 194
Health discovery 194
K/V store 195
Multiple data centers 195
JHipster Gateway 195
Netflix Zuul 195
Hystrix 196
JHipster Console 197
Elasticsearch 197
Logstash 197
Kibana 198
Zipkin 198
Prometheus 198
JHipster UAA server 200

[ vi ]
Table of Contents

Summary 201
Chapter 9: Building Microservices with JHipster 202
Application architecture 203
Gateway application generation 204
Converting a monolithic application to a microservice gateway 205
Application generation 206
Generating a new Gateway 207
Gateway configuration 213
JWT authentication 217
How JWT works 217
Microservice application - Invoice Service with MySQL database 220
Application generation 220
Microservice configuration 225
Microservice application - notification service with NoSQL
database 229
Application generation 229
Microservice configuration 231
Summary 232
Chapter 10: Working with Microservices 233
Setting up JHipster Registry locally 233
Using a pre-packaged WAR file 235
Building from source 237
Docker mode 237
Running a generated application locally 239
Gateway application pages 239
JHipster Registry pages 242
System status 243
Below renew threshold 243
Instances registered 243
General info and health 243
Application listing page 244
Metrics page 245
Health page 247
Configuration page 248
Logs page 248
Swagger API endpoints 249

[ vii ]
Table of Contents

Running invoice and notification applications locally 255


Modeling entities in JDL 257
Entity generation on microservices 260
Explaining the generated code 262
Gateway application 264
Explaining the generated pages 265
Summary 266
Chapter 11: Deploying with Docker Compose 267
Introducing microservice deployment options 267
A short introduction to Docker Compose 268
Kickstarting Kubernetes 270
Introducing OpenShift 273
Explaining Rancher 273
Generated Docker Compose files 273
Walking through the generated files 274
Building and deploying everything to Docker locally 279
Generating docker-compose files for microservices 280
Features of the deployed application 285
JHipster console demo 286
Scaling up with Docker Swarm 289
Summary 290
Chapter 12: Deploying to the Cloud with Kubernetes 291
Generating Kubernetes configuration files with JHipster 291
Walking through the generated files 297
Deploying the application to Google Cloud with Kubernetes 300
Summary 306
Chapter 13: Using React for the Client-Side 307
Generating an application with React client side 307
Technical stack and source code 310
Technical stacks 311
Using TypeScript 311
State management with Redux and friends 312
Routing with React Router 313
HTTP requests using Axios 314
Bootstrap components using Reactstrap 314

[ viii ]
Visit https://testbankfan.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
Table of Contents

Unit testing setup 315


Generating source code 315
Generating an entity with React client side 322
Summary 328
Chapter 14: Best Practices with JHipster 329
The next steps to pursue 330
Adding a shopping cart for the application 330
Improving end-to-end tests 331
Improving the CI/CD pipeline 332
Building a JHipster module 332
Best practices to keep in mind 333
Choosing a client-side framework 333
Choosing a database option 334
Architecture considerations 335
Security considerations 336
Deployment and maintenance 336
General best practices 337
Using JHipster modules 338
Contributing to JHipster 339
Summary 340
Other Books You May Enjoy 341

Index 344

[ ix ]
Preface
This book, Full Stack development with JHipster, aims to address the following challenges
faced by full-stack developers today:

There are multitudes of technologies and options out there to learn


Customer demands have increased and hence time to market has become more
stringent
Client-side frameworks have become complicated and difficult to integrate
There is so much integration between technologies and concepts that it
overwhelms most novice and even proficient developers

JHipster provides a platform for developers to easily create web applications and
microservices from scratch, without having to spend a lot of time wiring everything
together and integrating technologies together. This frees up time immensely for developers
to actually focus on their solution rather than spending time learning and writing
boilerplate code. JHipster will help novice and experienced developers to be more
productive from day one. It's like pair programming with an entire community.

This book will take you on a journey from zero to hero in full stack development. You will
learn to create complex production-ready Spring Boot and Angular web applications from
scratch using JHipster and will go on to develop and deploy features and business logic on
cloud services. You will also learn about microservices and how to convert a monolithic
application into the microservice architecture as it evolves using JHipster. Additionally, you
will learn how to make use of the new React support being introduced in JHipster and
about various best practices and suggestions from the JHipster community and the core
development team.
Preface

Who this book is for


Anyone with a basic understanding of building Java web applications and basic exposure to
Spring and Angular/React can benefit from using this book to learn how to use JHipster for
cutting-edge full-stack development or to improve their productivity by cutting down
boilerplate and learning new techniques. The audience can be broadly classified as follows:

Full stack web app developers who want to reduce the amount of boilerplate they
write and save time, especially for greenfield projects.
Backend developers who want to learn full stack development with Angular or
React
Full-stack developers who want to learn microservice development
Developers who want to jump-start their full stack web application or
microservice development
Developers who want to quickly prototype web applications or microservices

What this book covers


$IBQUFS, Introduction to Modern Web Application Development, introduces two widely used
full-stack web application development architectures. It also lays out commonly faced
challenges in full stack web application development.

$IBQUFS, Getting Started with JHipster, introduces the JHipster platform. It will also give
the reader a brief overview of different server-side, client-side, and DB technology options
offered by JHipster. This chapter will also provide instructions to install and use JHipster
and various tools and options supported by it.

$IBQUFS, Building Monolithic Web Applications with JHipster, guides the user through the
creation of a production-ready Spring boot and Angular web applications from scratch
using JHipster and will take the reader through the generated code, screens, and concepts.

$IBQUFS, Entity Modeling with JHipster Domain Language, introduces the reader to JHipster
domain language (JDL) and will teach build business logic with entity modeling and entity
creation using JDL and JDL studio.

[2]
Preface

$IBQUFS, Customization and Further Development, guides the reader through further
development of the generated application. It will also teach how to the reader more about
using technologies such as Angular, Bootstrap, Spring Security, Spring MVC REST, and
Spring Data.

$IBQUFS, Testing and Continuous Integration, guides the reader through testing and setting
up a continuous integration pipeline using Jenkins.

$IBQUFS, Going into Production, shows the reader how to use Docker and how to build and
package the app for production. It will also introduce the reader to some of the production
cloud deployment options supported by JHipster.

$IBQUFS, Introduction to Microservice Server-Side Technologies, gives an overview of


different options available in the JHipster microservice stack.

$IBQUFS, Building Microservices with JHipster, guides the reader through converting a
JHipster monolith web application into a full-fledged microservice architecture with a
Gateway, Registry, monitoring console, and multiple microservices. It will also guide the
reader through the generated code and components such as JHipster registry, JHipster
console, API gateway, and JWT.

$IBQUFS, Working with Microservices, guides the reader through running the generated
applications locally and creating domain entities for the microservice architecture using
JHipster domain language.

$IBQUFS, Deploying with Docker Compose, introduces the reader to advanced local and
cloud deployment options for microservices. It will also guide the user through local
deployment and testing of the generated microservice stack using Docker Compose and
JHipster.

$IBQUFS, Deploying to the Cloud with Kubernetes, guides the user through the Google
cloud deployment of the generated microservice stack using Kubernetes and JHipster.

$IBQUFS, Using React for the Client-Side, takes the user through generating an application
with React on the client side instead of Angular using JHipster.

$IBQUFS, Best Practices with JHipster, summarizes what the reader has learned so far and
will suggest best practices and next steps to utilize the skills learned.

[3]
Preface

To get the most out of this book


To get the most out of this book, you will need to know basics of the following technologies:

Web technologies (HTML, JavaScript, and CSS)


Java 8
Basics of the Spring Framework
Basic understanding of SQL databases
Build tools (Maven or Gradle)
npm or Yarn

It will also be easier if you are familiar with using technologies such as Docker and
Kubernetes, as it will help you grasp some of the chapters easily.

You will also need JDK8, Git, Docker, and NodeJS installed; your favorite web browser; a
terminal application; and your favorite code editor/IDE.

Download the example code files


You can download the example code files for this book from your account at
XXXQBDLUQVCDPN. If you purchased this book elsewhere, you can visit
XXXQBDLUQVCDPNTVQQPSU and register to have the files emailed directly to you.

You can download the code files by following these steps:

1. Log in or register at XXXQBDLUQVCDPN.


2. Select the SUPPORT tab.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box and follow the onscreen
instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the
latest version of:

WinRAR/7-Zip for Windows


Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux

[4]
Discovering Diverse Content Through
Random Scribd Documents
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like