Spring / Resilience4j Interview questions
How do you configure Resilience4j using application.yml in Spring Boot?
resilience4j: circuitbreaker: instances: paymentService: slidingWindowSize: 20 failureRateThreshold: 50 waitDurationInOpenState: 10s permittedNumberOfCallsInHalfOpenState: 5 retry: instances: paymentService: maxAttempts: 3 waitDuration: 500ms bulkhead: instances: paymentService: maxConcurrentCalls: 10
Each module gets its own top-level key under resilience4j, and each named instance under instances corresponds to the name attribute used on the matching annotation - so @CircuitBreaker(name = "paymentService") picks up exactly the paymentService block shown above.
A shared configs.default block can define baseline values that every instance inherits unless it overrides a specific property, which avoids repeating the same settings across many similarly-configured instances.
More Related questions...