| | |
| | | package com.ruoyi.common.ratelimiter.annotation; |
| | | |
| | | import com.ruoyi.common.core.constant.GlobalConstants; |
| | | import com.ruoyi.common.ratelimiter.enums.LimitType; |
| | | |
| | | import java.lang.annotation.*; |
| | |
| | | @Documented |
| | | public @interface RateLimiter { |
| | | /** |
| | | * 限流key |
| | | * 限流key,支持使用Spring el表达式来动态获取方法上的参数值 |
| | | * 格式类似于 #code.id #{#code} |
| | | */ |
| | | String key() default GlobalConstants.RATE_LIMIT_KEY; |
| | | String key() default ""; |
| | | |
| | | /** |
| | | * 限流时间,单位秒 |
| | |
| | | * 限流类型 |
| | | */ |
| | | LimitType limitType() default LimitType.DEFAULT; |
| | | |
| | | /** |
| | | * 提示消息 支持国际化 格式为 {code} |
| | | */ |
| | | String message() default "{rate.limiter.message}"; |
| | | } |