DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • 7 Microservices Best Practices for Developers
  • Spring Reactive Microservices: A Showcase
  • How To Implement OAuth2 Security in Microservices
  • The Principles of Planning and Implementing Microservices

Trending

  • Implement RAG Using Weaviate, LangChain4j, and LocalAI
  • How to Query XML Files Using APIs in Java
  • Integration of AI Tools With SAP ABAP Programming
  • ChatGPT Code Smell [Comic]
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. Microservices With JHipster

Microservices With JHipster

In this article, we will be looking at the microservices stack that JHipster, a code generation tool, generates and supports.

By 
Kiran Kumar user avatar
Kiran Kumar
·
Jul. 07, 21 · Analysis
Like (12)
Save
Tweet
Share
11.2K Views

Join the DZone community and get the full member experience.

Join For Free

JHipster is a code generation tool that can create web applications, microservices, deployment files for Kubernetes, cloud integrations, and CI/CD Jenkins files. This tool is very helpful for developers who can quickly generate the code and avoid creating a boilerplate code, which saves 30% of the effort.

JHipster supports back-end code in Spring Boot and front-end code in Angular/React/Vue.js.

In this article, we will be looking at the microservices stack that JHipster generates and supports.

Microservices are independent, modular deployable components split by business domain models, business functionalities that are scalable, efficient, and rapidly deployable.

Microservices are made up of several components including Service registry, Service discovery, Health check, Resiliency, Fault tolerance, and Security.

JHipster supports the following components for the Microservices to accomplish the above-mentioned components:

1. JHipster Registry: This is the service registry where different microservices can register and discover the configuration. The registry also provides monitoring and health check dashboards.

JHipster Registry is built on 2 components: Netflix Eureka and Spring Cloud Config Server.

a. Netflix Eureka: Eureka provides dynamic service registration and discovery. Eureka maintains a central service registry that can register the new microservices and delist the service when it goes down. The registry maintains up-to-date information on the services available and their metadata. The services that get registered to the Eureka server send their heartbeats and when the client no longer sends a heartbeat, the service is taken out of the registry.

Eureka provides dynamic discovery where clients look for the service registry to get the service information like the URL of the service and connects through the URL.

Microservices flow chart.

b. Spring Cloud Config Server: This provides the centralized store for managing the properties and configurations for all the microservices.

Microservice can connect to the cloud-config service and get the configuration details. The config service can also be exposed to a Rest API.

Config. flow chart.

2. HashiCorp Consul: Consul is a service discovery client from HashiCorp. Consul provides service discovery, fault tolerance, vault for key-value storage. This is an alternative to JHipster Registry that can provide both service discovery and configuration store.

Eureka supports application services written in Spring Boot. Consul can support multiple clients written in Java, Golang, or other programming languages.

Consul supports multiple data centers out of the box. The node that runs Consul runs a consul agent that monitors the health of the service.

3. JHipster API Gateway

JHipster provides Gateway, which is the single point of entry for accessing the services. Gateway provides request, response transformation, API security, caching, throttling, routing, filtering, and fault tolerance.

JHipster gateway integrates with Zuul for API Gateway features and Hystrix for resiliency and circuit breaker features. As Hystrix support will be removed in the future, JHipster is looking for Resilience4J integration for circuit breaker features.

Hystrix or Resilience4J stops the cascading failures in distributed systems, enables fallback services, controls the latency of the system.

JHipster API Gateway will work with JHipster Registry for service discovery and load balance HTTP requests using Spring Cloud Load Balancer.

Cloud VM flow chart.

4. JHipster Control Center: The control center monitors and manages applications. The control center provides the following features:

a. Instances: Instances provide a list of application instances; when the service gets registered in the JHipster Registry, the service is available in the list of instances. It also provides a dashboard to view the list.

b. Metrics: The metrics are managed by a Micrometer that tracks system metrics like JVM, HTTP requests, cache usage, and database connections.

c. Health checks: The health checks are integrated with Spring Actuator to get the status of health of services.

d. Logs: Logs are integrated with Logback to trace the logs of the running application.

e. API documentation: API documentation provides Swagger APIn documentation.

5. Security with JWT: JWT is a stateless security mechanism that can be scaled to multiple servers. This is the default security option for JHipster Microservices. 

JWT provides Header, Payload, and Signature. All the client session data is stored in the token. No server-side session management is being done in JWT. JWT is supported by OAuth 2.0 for secure transmission.

JWT structure flow chart.

6. Microservice Security with JHipster UAA: JHipster UAA is user accounting and authoring microservices using OAuth2.

OAuth2 is an authorization framework that can be used for centralized identity management. JHipster UAA provides an OAuth2 endpoint that provides access token based on the authentication. The token provides fine-grained access control to access the Rest based services. UAA is the combination of the authorization server and the resource server.

The sample OAuth flow depicted below:

Authorization code flow chart.

The sample architecture stack generated for Microservices using JHipster is depicted below:

Sample architecture stack flow chart.


In this article, different microservices components supported by JHipster are described, which gives you an idea of how to build the Microservices stack using JHipster. Thanks for reading!

microservice JHipster Web Service Spring Framework Spring Cloud security Service discovery authentication application Discovery (law)

Opinions expressed by DZone contributors are their own.

Related

  • 7 Microservices Best Practices for Developers
  • Spring Reactive Microservices: A Showcase
  • How To Implement OAuth2 Security in Microservices
  • The Principles of Planning and Implementing Microservices

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: