!290 限流注解和实现的更新

* 限流注解的自定义注解以及使用SpringEl表达式动态定义Key
This commit is contained in:
boasad
2023-02-26 12:27:25 +00:00
committed by 疯狂的狮子Li
parent f88c93b335
commit 995578c561
2 changed files with 58 additions and 9 deletions

View File

@ -15,7 +15,8 @@ import java.lang.annotation.*;
@Documented
public @interface RateLimiter {
/**
* 限流key
* 限流key,支持使用Spring el表达式来动态获取方法上的参数值
* 格式类似于 #code.id #{#code}
*/
String key() default CacheConstants.RATE_LIMIT_KEY;
@ -33,4 +34,9 @@ public @interface RateLimiter {
* 限流类型
*/
LimitType limitType() default LimitType.DEFAULT;
/**
* 提示消息 支持国际化 格式为 {code}
*/
String message() default "{rate.limiter.message}";
}