update 优化 限流注解 又写key又不是表达式的情况
parent
232fa9fc42
commit
bed1911b4d
|
|
@ -80,11 +80,11 @@ public class RateLimiterAspect {
|
||||||
|
|
||||||
private String getCombineKey(RateLimiter rateLimiter, JoinPoint point) {
|
private String getCombineKey(RateLimiter rateLimiter, JoinPoint point) {
|
||||||
String key = rateLimiter.key();
|
String key = rateLimiter.key();
|
||||||
if (StringUtils.isNotBlank(key)) {
|
// 判断 key 不为空 和 不是表达式
|
||||||
|
if (StringUtils.isNotBlank(key) && StringUtils.containsAny(key, "#")) {
|
||||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||||
Method targetMethod = signature.getMethod();
|
Method targetMethod = signature.getMethod();
|
||||||
Object[] args = point.getArgs();
|
Object[] args = point.getArgs();
|
||||||
//noinspection DataFlowIssue
|
|
||||||
MethodBasedEvaluationContext context =
|
MethodBasedEvaluationContext context =
|
||||||
new MethodBasedEvaluationContext(null, targetMethod, args, pnd);
|
new MethodBasedEvaluationContext(null, targetMethod, args, pnd);
|
||||||
context.setBeanResolver(new BeanFactoryResolver(SpringUtils.getBeanFactory()));
|
context.setBeanResolver(new BeanFactoryResolver(SpringUtils.getBeanFactory()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue