通过 VITE_AUTO_FILL_TEST 环境变量控制,在 .env.test 中启用, 使测试环境构建后登录框也能自动填充测试账号,方便测试人员使用。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
633 B
Java
35 lines
633 B
Java
package com.lesingle.common.annotation;
|
||
|
||
import java.lang.annotation.*;
|
||
import java.util.concurrent.TimeUnit;
|
||
|
||
/**
|
||
* 接口速率限制注解
|
||
* 用于公开接口防止恶意调用
|
||
*/
|
||
@Target(ElementType.METHOD)
|
||
@Retention(RetentionPolicy.RUNTIME)
|
||
@Documented
|
||
public @interface RateLimit {
|
||
|
||
/**
|
||
* 时间窗口内允许的最大请求次数
|
||
*/
|
||
int permits() default 10;
|
||
|
||
/**
|
||
* 时间窗口大小
|
||
*/
|
||
long duration() default 1;
|
||
|
||
/**
|
||
* 时间单位
|
||
*/
|
||
TimeUnit timeUnit() default TimeUnit.SECONDS;
|
||
|
||
/**
|
||
* 限制维度:ip / user
|
||
*/
|
||
String key() default "ip";
|
||
}
|