Tag Archives: Spring Cloud

10 AI Prompts for Designing Java Microservices

Microservices architecture introduces a class of problems that monoliths simply do not have: partial failures, distributed transactions, network latency between services, schema versioning across independent deployments, and the operational complexity of coordinating dozens of independently deployed components. The first time I designed a circuit breaker configuration for a production service, I guessed the thresholds. The circuit opened too aggressively during a transient network hiccup and caused more downtime than the downstream failure it was meant to protect against. The second time, I ran the numbers from the downstream service’s SLA and worked backwards. There was no tutorial that taught me to do that — I learned it the hard way. These 10 prompts encode the questions you need to answer before you configure Resilience4j, write an OpenAPI contract, or design a Kafka consumer group — so the AI produces configuration that fits your actual failure scenario rather than a generic example. Getting these patterns right requires both architectural experience and fluency with a large surface area of libraries and specifications. AI assistants are well-positioned here — they know the Resilience4j API, the OpenAPI specification, the Kafka consumer group model, the Micrometer tracing API, and the Kubernetes health probe semantics.

This post gives you 10 copy-paste AI prompts for designing Java microservices. Each prompt targets a specific cross-cutting architecture concern and is engineered to produce production-grade, runnable output rather than pseudocode.

For related reading, see 10 AI Prompts for Spring Boot Development and the Java series. For the Spring AI and LLM Gateway patterns, see the LLM Gateway for Java Microservices post.

Continue reading 10 AI Prompts for Designing Java Microservices

A Practical Guide to Monitoring Spring Boot Microservices with Prometheus & Grafana

Microservices are powerful. They allow us to build scalable, resilient, and independently deployable systems. But this power comes with a cost: complexity. When you have dozens or even hundreds of services interacting, figuring out what’s going on—especially when something goes wrong—can feel like searching for a needle in a haystack of haystacks.

This is where observability comes in. It’s more than just “monitoring”; it’s about gaining deep, actionable insights into your system’s behavior. We can break observability down into three pillars:

  • Logs: Structured, event-based records of what happened. “User X failed to log in at 10:05 PM.”
  • Metrics: Aggregated, numerical data over time. “The average API response time over the last 5 minutes was 200ms.”
  • Traces: The end-to-end journey of a request as it travels through multiple services. “Request ABC started at the API gateway, went to the user-service, then the auth-service, and took 350ms in total.”

In this guide, we’ll focus on the cornerstone of observability: metrics. We’ll build a complete, production-grade monitoring stack for a Spring Boot microservice using an industry-standard toolkit.

The Monitoring Dream Team

We’ll use a combination of powerful tools that work seamlessly together:

  1. Spring Boot Actuator: Provides production-ready features for our app, including a wealth of internal metrics out-of-the-box.
  2. Micrometer: An application metrics facade that acts as a universal translator. Spring Boot uses it to format its metrics so that various monitoring systems can understand them. We’ll configure it to talk “Prometheus”.
  3. Prometheus: The powerhouse of our stack. It’s a time-series database that periodically “scrapes” (pulls) metrics from our application and stores them efficiently.
  4. Grafana: The visualization layer. Grafana connects to Prometheus, queries the stored metrics, and turns them into beautiful, insightful dashboards.

Here’s the data flow we’re building:

Spring Boot App → Actuator → Micrometer → a /prometheus endpoint → Prometheus Scraper → Grafana Dashboard

Let’s get building!

Continue reading A Practical Guide to Monitoring Spring Boot Microservices with Prometheus & Grafana

Spring Cloud: Getting started with Hystrix Dashboard

⚠️ This tutorial is outdated. Hystrix Dashboard was removed from Spring Cloud and does not work with Spring Boot 3.x. The modern approach is Resilience4j metrics with Prometheus & Grafana — see the Spring Cloud Netflix migration guide. This post remains online for teams maintaining legacy systems.

This is a quick tutorial on Hystrix dashboard. Hystrix dashboard allows you to view the overall status of your Spring cloud application at a single glance. It provides access to vital metrics of your application and gives you a graphical representation of those for better understanding.

This post is the continuation of Spring Cloud: Adding Hystrix Circuit Breaker and Spring Cloud: Playing with Hystrix Circuit Breaker. Please go through those post, if you haven’t. Those posts explain about Hystrix circuit breaker.

TL;DR You can download whole project by clicking following link.

Continue reading Spring Cloud: Getting started with Hystrix Dashboard

Spring Cloud Config Server on Spring Boot 3.x: Git Mode, Native Mode, and Runtime Refresh

Spring Cloud Config is, alongside Eureka, one of the two survivors of the original Spring Cloud stack — still maintained, still the standard answer for centralized configuration outside Kubernetes. This post is a complete rewrite of my 2020 Config Server tutorials for Spring Boot 3.x: a Config Server backed by Git (with native/filesystem mode for local development), clients using the modern spring.config.import mechanism instead of the long-gone bootstrap.properties, and runtime refresh that actually works.

Continue reading Spring Cloud Config Server on Spring Boot 3.x: Git Mode, Native Mode, and Runtime Refresh

Spring Cloud: Exploring Spring Cloud Config Server (Native Mode)

⚠️ This tutorial covers an old Spring Cloud version. Spring Cloud Config is still maintained, but this setup targets Spring Boot 2.x. For Spring Boot 3.x configuration (Git and native mode), see the updated Spring Cloud Config Server guide and the Spring Cloud Netflix migration guide.

This is a quick tutorial on Spring Cloud Config Server. In brief, Spring cloud config allows you to have applications/micro-services configuration at a centralized place. Since we are working on spring micro-services, in production we may have hundreds of micro-services running together. Now if we want to manage configuration for hundreds of those micro-services then it would be a big pain if we do it manually. Instead, we will use Spring cloud config server to manage that configuration from a central place.

TL;DR You can download whole project by clicking following link.

Continue reading Spring Cloud: Exploring Spring Cloud Config Server (Native Mode)

Spring Cloud: Adding Filters in Zuul Gateway

⚠️ This tutorial is outdated. Zuul 1 (including its filter model) was removed from Spring Cloud and does not work with Spring Boot 3.x. Filters are now written as Gateway filters — see the Zuul to Spring Cloud Gateway migration guide and the Spring Cloud Netflix migration guide. This post remains online for teams maintaining legacy systems.

This tutorial is the continuation of Spring Cloud: Exploring Zuul Gateway tutorial. In this tutorial, we will be exploring the functionality of filters provided by Zuul.

As discussed earlier Zuul provides various filters which we can use for request validation or processing. Let’s say if you have an incoming request and if you want to check whether the user is authenticated or not, you can use Zuul pre-filter for this.  If your request is processed and if you want to encrypt the response you can use Zuul post filter. The major upside of Zuul filter is, you can manage all of your filters at a centralized location.

Zuul has provision to create following four types of filter.

  1. pre filters run before the request is routed.
  2. route filters can handle the actual routing of the request.
  3. post filters run after the request has been routed.
  4. error filters run if an error occurs while handling the request.
Continue reading Spring Cloud: Adding Filters in Zuul Gateway

Spring Cloud: Exploring Zuul Gateway

⚠️ This tutorial is outdated. Zuul 1 was removed from Spring Cloud and does not work with Spring Boot 3.x. For current projects, use Spring Cloud Gateway — and see the Spring Cloud Netflix migration guide for the full modern stack. This post remains online for teams maintaining legacy systems.

This is a quick tutorial for Spring cloud Zuul component. In this tutorial, we will explore Zuul functionality and will create a gateway to our Spring cloud environment using Zuul.

What is Zuul?

Zuul is a gateway component in Spring cloud ecosystem. It provides access to the services present in our Spring cloud from services/applications which are outside of our environment.

Zuul creates a single entry point for our application which we can use from the outside world. In our environment, we might have 100’s of services running, each one serving a special purpose. Now if we want to access those services via another network or from the internet, then exposing those 100 services will not be a great idea.

In such cases, Zuul comes handy. It provides us with a single proxy to access those services. Apart from that Zuul also provides request filters. We can use those to check/process each and every request before it hits the actual service.

TL;DR You can download whole project by clicking following link.

Continue reading Spring Cloud: Exploring Zuul Gateway