spring-boot-resilience4j

Apply Resilience4j circuit breakers, retries, and fallbacks to Spring Boot microservices.

322|37|Updated Oct 21, 2025
One-click install
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill spring-boot-resilience4j
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-boot-resilience4j
Source: https://github.com/giuseppe-trisciuoglio/developer-kit/tree/main/skills/spring-boot/spring-boot-resilience4j
Command: npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill spring-boot-resilience4j

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides fault-tolerance patterns using Resilience4j, including circuit breakers, retries, rate limiters, bulkheads, time limits, and fallbacks for robust microservices.

Core Features & Use Cases

  • Circuit breakers, retries, rate limiters
  • Bulkheads and time limiters
  • Fallbacks and monitoring integration
  • Production-ready configuration patterns

Quick Start

Apply @CircuitBreaker and @Retry annotations on a fragile service method and configure a basic fallback.

Frequently Asked Questions about spring-boot-resilience4j

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement circuit breakers in Spring Boot to prevent cascading failures?

Circuit breakers stop requests to failing services by monitoring call outcomes and opening when failures exceed a threshold. Use Resilience4j's @CircuitBreaker annotation on Spring Boot service methods to automatically manage state transitions between closed, open, and half-open states, protecting downstream dependencies from overload.

What's the best way to add retries and timeouts to Spring Boot microservices?

Resilience4j provides @Retry and @TimeLimiter annotations that automatically retry failed requests and enforce execution deadlines on Spring Boot methods. Configure retry policies and timeout thresholds in YAML to handle transient failures and prevent indefinite hangs when calling external services.

How do bulkheads and rate limiters protect microservices from resource exhaustion?

Bulkheads isolate thread pools to limit concurrent requests per operation, while rate limiters control request velocity. Resilience4j's @Bulkhead and @RateLimiter annotations on Spring Boot methods prevent one slow dependency from consuming all threads or overwhelming a service under load.

Can I use Resilience4j patterns with Spring AOP for annotation-driven configuration?

Yes. Resilience4j integrates seamlessly with Spring AOP to apply fault-tolerance patterns via annotations like @CircuitBreaker, @Retry, @RateLimiter, @Bulkhead, and @TimeLimiter on service methods. Configure patterns in YAML and Spring automatically applies aspect-driven resilience at runtime.

How do I add fallbacks when external service calls fail in Spring Boot?

Fallbacks define alternative responses when protected methods fail. Combine Resilience4j patterns with Spring's @Fallback or method-level fallback handlers to return cached data, default values, or graceful degradation when circuit breakers open or retries exhaust.

What monitoring and metrics does Resilience4j provide for fault tolerance?

Resilience4j exports metrics on circuit breaker state changes, retry attempts, rate limit rejections, bulkhead saturation, and timeout occurrences. Integrate with Spring Boot Actuator and monitoring platforms to observe resilience pattern behavior and alert on failures.