docs 补充项目注释
This commit is contained in:
+3
@@ -19,6 +19,9 @@ public @interface RepeatSubmit {
|
||||
*/
|
||||
int interval() default 5000;
|
||||
|
||||
/**
|
||||
* 重复提交间隔时间单位。
|
||||
*/
|
||||
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
|
||||
|
||||
/**
|
||||
|
||||
+6
@@ -50,6 +50,12 @@ public class RateLimiterAspect {
|
||||
private final ParameterNameDiscoverer pnd = new DefaultParameterNameDiscoverer();
|
||||
|
||||
|
||||
/**
|
||||
* 在限流注解方法执行前扣减令牌,令牌不足时阻断请求。
|
||||
*
|
||||
* @param point 切点信息
|
||||
* @param rateLimiter 限流注解配置
|
||||
*/
|
||||
@Before("@annotation(rateLimiter)")
|
||||
public void doBefore(JoinPoint point, RateLimiter rateLimiter) {
|
||||
int time = rateLimiter.time();
|
||||
|
||||
+5
@@ -13,6 +13,11 @@ import org.springframework.data.redis.connection.RedisConfiguration;
|
||||
@AutoConfiguration(after = RedisConfiguration.class)
|
||||
public class IdempotentConfig {
|
||||
|
||||
/**
|
||||
* 创建重复提交切面。
|
||||
*
|
||||
* @return 重复提交切面
|
||||
*/
|
||||
@Bean
|
||||
public RepeatSubmitAspect repeatSubmitAspect() {
|
||||
return new RepeatSubmitAspect();
|
||||
|
||||
+7
@@ -6,12 +6,19 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.connection.RedisConfiguration;
|
||||
|
||||
/**
|
||||
* 限流功能配置。
|
||||
*
|
||||
* @author guangxin
|
||||
* @date 2023/1/18
|
||||
*/
|
||||
@AutoConfiguration(after = RedisConfiguration.class)
|
||||
public class RateLimiterConfig {
|
||||
|
||||
/**
|
||||
* 创建限流切面。
|
||||
*
|
||||
* @return 限流切面
|
||||
*/
|
||||
@Bean
|
||||
public RateLimiterAspect rateLimiterAspect() {
|
||||
return new RateLimiterAspect();
|
||||
|
||||
Reference in New Issue
Block a user