ratelimiter prefix to customize its behavior.
Configuration properties
Global switch for rate limiter auto-configuration. Set to
false to completely disable the rate limiter.Redis key prefix used for rate-limit buckets. All rate limit counters stored in Redis will be prefixed with this value.The final Redis key format is:
{prefix}:{key}:{windowStartMillis}Failure strategy when Redis is unavailable.
false: Fail-closed (throwRateLimiterBackendException)true: Fail-open (allow request to proceed)
Whether HTTP 429 responses should include rate-limit headers.When enabled, the following headers are added to 429 responses:
X-RateLimit-Limit: The rate limit quotaX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Time when the rate limit resetsRetry-After: Seconds until the next request can be made
Whether Micrometer metrics should be recorded when a
MeterRegistry is present.When enabled and Micrometer is on the classpath, the rate limiter will record metrics for:- Request evaluations (allowed vs. denied)
- Backend failures
- Per-key rate limit statistics
Configuration examples
Minimal configuration
If you’re satisfied with the defaults, you don’t need to configure anything:The rate limiter will automatically configure itself when it detects a
StringRedisTemplate bean in your application context.