修复 全局限流key会多出一个"-" 将其移动到IP后面 去除多余的空格

This commit is contained in:
疯狂的狮子Li 2021-09-17 09:32:43 +00:00 committed by Gitee
parent 12ab8b03d9
commit f3a8b4625f

View File

@ -105,12 +105,12 @@ public class RateLimiterAspect
StringBuffer stringBuffer = new StringBuffer(rateLimiter.key()); StringBuffer stringBuffer = new StringBuffer(rateLimiter.key());
if (rateLimiter.limitType() == LimitType.IP) if (rateLimiter.limitType() == LimitType.IP)
{ {
stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest())); stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest())).append("-");
} }
MethodSignature signature = (MethodSignature) point.getSignature(); MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod(); Method method = signature.getMethod();
Class<?> targetClass = method.getDeclaringClass(); Class<?> targetClass = method.getDeclaringClass();
stringBuffer.append("-").append(targetClass.getName()).append("- ").append(method.getName()); stringBuffer.append(targetClass.getName()).append("-").append(method.getName());
return stringBuffer.toString(); return stringBuffer.toString();
} }
} }