Annotation Interface Limit


@Target(TYPE) @Retention(RUNTIME) public @interface Limit
Applies a rate limit to a class-based RequestHandler.

The annotation is processed at boot time by the LimiterExtension annotation processor. If key() names a resolver that was never registered, startup fails immediately with InitializationException.


 // 100 req/s per client IP — fixed window
 @Limit(requests = 100, window = 1)
 public class SearchHandler extends RequestHandler { ... }

 // 20 req/min per authenticated user — token bucket
 @Limit(key = "auth_user", requests = 20, window = 1, windowUnit = TimeUnit.MINUTES,
        strategy = LimitStrategy.TOKEN_BUCKET)
 public class ExpensiveHandler extends RequestHandler { ... }