Partner – Microsoft – NPI EA (cat = Baeldung)
announcement - icon

Azure Container Apps is a fully managed serverless container service that enables you to build and deploy modern, cloud-native Java applications and microservices at scale. It offers a simplified developer experience while providing the flexibility and portability of containers.

Of course, Azure Container Apps has really solid support for our ecosystem, from a number of build options, managed Java components, native metrics, dynamic logger, and quite a bit more.

To learn more about Java features on Azure Container Apps, visit the documentation page.

You can also ask questions and leave feedback on the Azure Container Apps GitHub page.

Partner – Microsoft – NPI EA (cat= Spring Boot)
announcement - icon

Azure Container Apps is a fully managed serverless container service that enables you to build and deploy modern, cloud-native Java applications and microservices at scale. It offers a simplified developer experience while providing the flexibility and portability of containers.

Of course, Azure Container Apps has really solid support for our ecosystem, from a number of build options, managed Java components, native metrics, dynamic logger, and quite a bit more.

To learn more about Java features on Azure Container Apps, you can get started over on the documentation page.

And, you can also ask questions and leave feedback on the Azure Container Apps GitHub page.

Partner – Orkes – NPI EA (cat=Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag=Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – Guide Spring Cloud – NPI EA (cat=Spring Cloud)
announcement - icon

Let's get started with a Microservice Architecture with Spring Cloud:

>> Join Pro and download the eBook

eBook – Mockito – NPI EA (tag = Mockito)
announcement - icon

Mocking is an essential part of unit testing, and the Mockito library makes it easy to write clean and intuitive unit tests for your Java code.

Get started with mocking and improve your application tests using our Mockito guide:

Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Reactive – NPI EA (cat=Reactive)
announcement - icon

Spring 5 added support for reactive programming with the Spring WebFlux module, which has been improved upon ever since. Get started with the Reactor project basics and reactive programming in Spring Boot:

>> Join Pro and download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Jackson – NPI EA (cat=Jackson)
announcement - icon

Do JSON right with Jackson

Download the E-book

eBook – HTTP Client – NPI EA (cat=Http Client-Side)
announcement - icon

Get the most out of the Apache HTTP Client

Download the E-book

eBook – Maven – NPI EA (cat = Maven)
announcement - icon

Get Started with Apache Maven:

Download the E-book

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

eBook – RwS – NPI EA (cat=Spring MVC)
announcement - icon

Building a REST API with Spring?

Download the E-book

Course – LS – NPI EA (cat=Jackson)
announcement - icon

Get started with Spring and Spring Boot, through the Learn Spring course:

>> LEARN SPRING
Course – RWSB – NPI EA (cat=REST)
announcement - icon

Explore Spring Boot 3 and Spring 6 in-depth through building a full REST API with the framework:

>> The New “REST With Spring Boot”

Course – LSS – NPI EA (cat=Spring Security)
announcement - icon

Yes, Spring Security can be complex, from the more advanced functionality within the Core to the deep OAuth support in the framework.

I built the security material as two full courses - Core and OAuth, to get practical with these more complex scenarios. We explore when and how to use each feature and code through it on the backing project.

You can explore the course here:

>> Learn Spring Security

Course – LSD – NPI EA (tag=Spring Data JPA)
announcement - icon

Spring Data JPA is a great way to handle the complexity of JPA with the powerful simplicity of Spring Boot.

Get started with Spring Data JPA through the guided reference course:

>> CHECK OUT THE COURSE

Partner – MongoDB – NPI EA (tag=MongoDB)
announcement - icon

Traditional keyword-based search methods rely on exact word matches, often leading to irrelevant results depending on the user's phrasing.

By comparison, using a vector store allows us to represent the data as vector embeddings, based on meaningful relationships. We can then compare the meaning of the user’s query to the stored content, and retrieve more relevant, context-aware results.

Explore how to build an intelligent chatbot using MongoDB Atlas, Langchain4j and Spring Boot:

>> Building an AI Chatbot in Java With Langchain4j and MongoDB Atlas

Partner – LambdaTest – NPI EA (cat=Testing)
announcement - icon

Accessibility testing is a crucial aspect to ensure that your application is usable for everyone and meets accessibility standards that are required in many countries.

By automating these tests, teams can quickly detect issues related to screen reader compatibility, keyboard navigation, color contrast, and other aspects that could pose a barrier to using the software effectively for people with disabilities.

Learn how to automate accessibility testing with Selenium and the LambdaTest cloud-based testing platform that lets developers and testers perform accessibility automation on over 3000+ real environments:

Automated Accessibility Testing With Selenium

Partner – Orkes – NPI (tag=Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

1. Introduction

In this writeup, we’ll explore an interesting example with JHipster – building a simple microservices architecture. We’ll show how to build and deploy all the required pieces, and in the end, we’ll have a full-blown microservice application up and running.

If you’re new to JHipster, please check our introductory article before proceeding to have a good understanding of the basics of this project generation tool.

2. Monolithic vs. Microservice

In our initial article, we illustrated how to create and bootstrap a monolithic application which is relatively easy to maintain.

Our microservice system, on the other hand, will separate the front-end the back-end which, in turn, can also be split into several small applications, each dealing with a subset of the full application domain. Naturally, as with all microservice implementations, this solves some problems but also introduces some complexity, such as dealing with component registry and security.

JHipster will take care of most difficulties of managing the microservice applications, with the help of modern open-source tools like Netflix’s Eureka Server and Hashicorp’s Consul.

There are, of course, some things to consider here, like how big or complicated our domain is, how critical is our application and what levels of availability do we want need to have, are we going to host our services on different servers and locations, etc. The goal of these tools is of course to these permutations possible and easy to manage.

2.1. JHipster Microservice Components

When working on a Microservice architecture with JHipster, we’ll need to build and deploy at least three different projects: a JHipster Registry, a Microservice Gateway, and at least one Microservice Application.

The JHipster Registry is an essential piece of the microservice architecture. It ties all the other components together and enables them to communicate with each other.

The Microservice Application contains the back-end code. Once running it will expose the API for the domain it is concerned with. A Microservice Architecture may be composed of many microservice applications, each containing a few related entities and business rules.

And the Microservice Gateway has all the front-end (Angular) code and will consume the API created by the whole group of micro service applications:

JHipster Microservice Architecture

3. Installation

For all the details about the installation process, check our introductory article on JHipster.

4. Creating a Microservice Project

Now let’s install the three core components of our microservice project.

4.1. Installing JHipster Registry

Since the JHipster Registry is a standard JHipster, so we just need to download and run it. There is no need to modify it:

git clone https://github.com/jhipster/jhipster-registry
cd jhipster-registry && ./mvnw

This will clone the jhipster-registry project from GitHub and start the application. Once it successfully starts up, we can visit http://localhost:8761/ and log in with user admin and password admin:

Captura de Tela

 

4.2. Installing a Microservice Application

Here is where we start to build the actual features of our project. In this example, we’ll create a simple Microservice Application that manages cars. So first we’ll create the application, and then we’ll add an entity to it:

# create a directory for the app and cd to it
mkdir car-app && cd car-app
# run the jhipster wizard
jhipster

Once the wizard starts, let’s follow the instructions to create a Microservice type application named carapp. Some other relevant parameters are:

  • port: 8081
  • package: com.car.app
  • authentication: JWT
  • service discovery: JHipster Registry

The screenshot below shows the complete set of options:

jhipster microservice app wizard

Now we’ll add a car entity to our application:

# runs entity creation wizard
jhipster entity car

The entity creation wizard will start. We should follow the instructions to create an entity named the car with three fields: make, model, and price.

In this case we are creating a single entity, if we aim to create many entities then we should use a graphical tool(JHipster UML or JDL Studio).

Once that’s finished, our first Microservice application is complete. If we have a look at the generated code, we’ll notice that there’s no javascript, HTML, CSS or any front-end code. Those will all be produced once the Microservice Gateway is created. Also, check out the README file for important information about the project and useful commands.

To finish up, let’s run our newly created component:

./mvnw

Before running the above command, we should ensure that the jhipster-registry component is up and running. Otherwise, we’ll get an error.

If everything went according to plan, our car-app would start, and the jhipster-registry log will tell us that the app was successfully registered:

Registered instance CARAPP/carapp:746e7525dffa737747dcdcee55ab43f8
  with status UP (replication=true)

4.3. Installing a Microservice Gateway

Now the front-end bit. We’ll create a Microservice Gateway and indicate to it that we have an entity on an existent component for which we want to create the front-end code:

# Create a directory for our gateway app
mkdir gateway-app && cd gateway-app
# Runs the JHipster wizard
jhipster

Let’s follow the instructions to create an application of type Microservice gateway. We’ll name the application gateway, and select the following options for the other parameters:

  • port: 8080
  • package: com.gateway
  • auth: JWT
  • service discovery: JHipster Registry

Here is a summary of the complete set of parameters:

jhipster microservice gateway wizard

Let’s move on to entity creation:

# Runs entity creation wizard
jhipster entity car

When asked if we want to generate from an existent microservice, choose Yes, then type in the relative path to the car-app root directory (ex.: ../car-app). Finally, when asked if we want to update the entity, choose Yes, regenerate the entity.

JHipster will find the Car.json file which is part of the existent Microservice Application we’ve created earlier and will use the metadata contained in that file to create all the necessary UI code for that entity:

Found the .jhipster/Car.json configuration file, entity can be automatically generated!

Time to run the gateway-app and test if everything is working:

# Starts up the gateway-app component
./mvnw

Let’s now navigate to http://localhost:8080/ and log in with user admin and password admin. On the top menu, we should see an item Car that will take us to the car list page. All good!

jhipster car page jhipster create car

4.4. Creating a Second Microservice Application

Next, let’s take our system one step further and create a second component of type Microservice Application. This new component will manage car dealers, so we’ll add an entity called the dealer to it.

Let’s create a new directory, navigate to it and run the yo jhipster command:

mkdir dealer-app && cd dealer-app
jhipster

After that, we type in dealerapp as the application’s name and choose port 8082 for it to run (it is critical that this is a different port than the ones we’re using for the jhipster-registry and car-app).

For the other parameters, we can choose any option we want. Remember this is a separate microservice so that it can use different database types, cache strategy, and tests than the car-app component.

Let’s add a couple of fields to our dealer entity. For example name and address:

# Runs the create entity wizard
jhipster entity dealer

We shouldn’t forget to navigate to gateway-app and tell it to generate the front-end code for the dealer entity:

# Navigate to the gateway-app root directory
cd ../gateway-app
# Runs the create entity wizard 
jhipster entity dealer

Finally, run ./mvnw on the dealer-app root directory to start up that component.

Next, we can visit our gateway application at http://localhost:8080 and refresh the page to see the newly created menu item for the Dealer entity.

Before we wrap up, let’s have a look at the jhipster-registry application again at http://localhost:8761/. Click on the Applications menu item to check that all of our three components were successfully identified and registered:
jhipster registered applications 1
Captura de Tela
That’s it! We’ve created a sophisticated architecture comprised of one Gateway app with all the front-end code backed by two microservices in just a few minutes.

5. Conclusion

Starting a Microservice Architecture project with JHipster is quite easy; we only need to create as many Microservice Applications as we need and one Microservice Gateway and we are ready to go.

You can explore the framework further over at the official JHipster website.

The code backing this article is available on GitHub. Once you're logged in as a Baeldung Pro Member, start learning and coding on the project.
Baeldung Pro – NPI EA (cat = Baeldung)
announcement - icon

Baeldung Pro comes with both absolutely No-Ads as well as finally with Dark Mode, for a clean learning experience:

>> Explore a clean Baeldung

Once the early-adopter seats are all used, the price will go up and stay at $33/year.

Partner – Microsoft – NPI EA (cat = Baeldung)
announcement - icon

Azure Container Apps is a fully managed serverless container service that enables you to build and deploy modern, cloud-native Java applications and microservices at scale. It offers a simplified developer experience while providing the flexibility and portability of containers.

Of course, Azure Container Apps has really solid support for our ecosystem, from a number of build options, managed Java components, native metrics, dynamic logger, and quite a bit more.

To learn more about Java features on Azure Container Apps, visit the documentation page.

You can also ask questions and leave feedback on the Azure Container Apps GitHub page.

Partner – Microsoft – NPI EA (cat = Spring Boot)
announcement - icon

Azure Container Apps is a fully managed serverless container service that enables you to build and deploy modern, cloud-native Java applications and microservices at scale. It offers a simplified developer experience while providing the flexibility and portability of containers.

Of course, Azure Container Apps has really solid support for our ecosystem, from a number of build options, managed Java components, native metrics, dynamic logger, and quite a bit more.

To learn more about Java features on Azure Container Apps, visit the documentation page.

You can also ask questions and leave feedback on the Azure Container Apps GitHub page.

Partner – Orkes – NPI EA (cat = Spring)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

Partner – Orkes – NPI EA (tag = Microservices)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

eBook – HTTP Client – NPI EA (cat=HTTP Client-Side)
announcement - icon

The Apache HTTP Client is a very robust library, suitable for both simple and advanced use cases when testing HTTP endpoints. Check out our guide covering basic request and response handling, as well as security, cookies, timeouts, and more:

>> Download the eBook

eBook – Java Concurrency – NPI EA (cat=Java Concurrency)
announcement - icon

Handling concurrency in an application can be a tricky process with many potential pitfalls. A solid grasp of the fundamentals will go a long way to help minimize these issues.

Get started with understanding multi-threaded applications with our Java Concurrency guide:

>> Download the eBook

eBook – Java Streams – NPI EA (cat=Java Streams)
announcement - icon

Since its introduction in Java 8, the Stream API has become a staple of Java development. The basic operations like iterating, filtering, mapping sequences of elements are deceptively simple to use.

But these can also be overused and fall into some common pitfalls.

To get a better understanding on how Streams work and how to combine them with other language features, check out our guide to Java Streams:

>> Join Pro and download the eBook

eBook – Persistence – NPI EA (cat=Persistence)
announcement - icon

Working on getting your persistence layer right with Spring?

Explore the eBook

Partner – MongoDB – NPI EA (tag=MongoDB)
announcement - icon

Traditional keyword-based search methods rely on exact word matches, often leading to irrelevant results depending on the user's phrasing.

By comparison, using a vector store allows us to represent the data as vector embeddings, based on meaningful relationships. We can then compare the meaning of the user’s query to the stored content, and retrieve more relevant, context-aware results.

Explore how to build an intelligent chatbot using MongoDB Atlas, Langchain4j and Spring Boot:

>> Building an AI Chatbot in Java With Langchain4j and MongoDB Atlas

Course – LS – NPI EA (cat=REST)

announcement - icon

Get started with Spring Boot and with core Spring, through the Learn Spring course:

>> CHECK OUT THE COURSE

eBook Jackson – NPI EA – 3 (cat = Jackson)