Category: Microservices with Spring
-
Why Do We Need a Gateway in a Microservices Application?
1. Introduction Microservices architecture has become a popular design choice for building scalable, flexible, and maintainable applications. Instead of a monolithic structure, applications are divided into smaller, independent services, each responsible for a specific business functionality. While this approach has many benefits, it also introduces challenges, particularly in managing communication, security, and monitoring across services.…
-
Eureka self-preservation mode
1. Introduction Eureka’s self-preservation mode is a built-in feature that helps prevent instances from being prematurely removed from the Eureka registry during transient network issues. This mode is triggered when Eureka detects that it has lost connection with a significant portion of its registered instances or clients. 2. What is Self-Preservation Mode? 3. Enabling/Disabling Self-Preservation…
-
Spring Cloud OpenFeign
1. Introduction In this tutorial, we’ll discuss Spring Cloud OpenFeign. This tutorial is a summary from documentation page of Spring Cloud OpenFeign. Spring Cloud OpenFeign project provides OpenFeign integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. 2. Declarative REST Client: Feign Feign is a…
-
Invoke other microservice using Feign client
1. Introduction In this tutorial, we’ll create use microservices – product and inventory. These microservices will be registered with a Eureka server. We’ll then call an endpoint of product microservice and this will call the inventory microservice. 2. Inventory microservice In our previous tutorials, we used product microservice. The inventory microservice is similar to that…
-
Spring Cloud Netflix
1. Introduction Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment. By using a few straightforward annotations, you can easily activate and configure common patterns within your application, enabling you to build robust distributed systems powered by reliable Netflix components. These patterns include Service Discovery…
-
Setup Service Discovery using Eureka server
1. Introduction In this tutorial we’ll discuss how to implement client side service discovery. Spring Cloud project makes Service Discovery setup is very easy with the help of following components: 2. Setup Eureka server Following is the main dependency we need to add for eureka server. Here is the complete pom.xml: Add @EnableEurekaServer annotation to…
-
Introduction to Service Discovery and Service Registration in microservices
1. Introduction In this tutorial, we’ll discuss why we need service discovery and service registration in microservices. Let us first understand the problem which service discovery and service registration tries to solve. Suppose we have three microservices: ‘Product’, ‘Order’ and ‘Delivery’. These microservices handle storing, fetching, and processing data, executing business logic, and responding to…
-
Liveness and Readiness probe in microservices
1. Introduction A liveness probe determines whether the container or application is operational. If it’s healthy, no intervention is needed as everything is running smoothly. If it’s unresponsive or unhealthy, corrective action, such as restarting the container, is triggered. In essence, the liveness probe verifies: “Is the container alive or not?” A readiness probe checks…
-
Refresh configurations at runtime using Spring Cloud Bus
1. Introduction If you have followed the tutorials till now, we set up our microservices with config server. But the problem with this approach. Whenever we want to refresh the configurations at runtime without restart, we have to invoke the refresh API for each microservice instance. To oversome this challenge we can use Spring Cloud…
-
Generate Docker image of Spring Boot application with Google Jib
1. Introduction In this tutorial, we’ll generate a Docker image of Spring Boot application with Google Jib. 2. What is Google Jib? Google Jib is an open-source Java containerization tool that allows developers to build Docker and OCI (Open Container Initiative) images for Java applications without needing a Docker daemon or writing a Dockerfile. Jib…