alibaba / alibaba/Sentinel

Update the SentinelResourceAspect's invokeResourceWithSentinel() method to get SentinelResource Annotation | 修改SentinelResourceAspect类里获取SentinelResource注解的方式

Open
#2,115 1 comment 0 reactions 0 assignees View on GitHub
area/annotation
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description

Type: *feature request*

### Describe what happened (or what feature you want)
SentinelResourceAspect的invokeResourceWithSentinel方法获取注解的方式为 :通过ProceedingJoinPoint 获取targetClass中method上的注解,但有些情况没法获取到原来的targetClass
![image](https://user-images.githubusercontent.com/39120148/114040206-fad99c80-98b5-11eb-8689-80eff7725a70.png)
以上情景是SentinelResource注解作用在接口的方法上,而这个接口的实现类是一个Retrofit生成的代理对象。

### Describe what you expected to happen
aop是支持匹配注解,希望能用这种方式获取,通过参数直接获取到方法上的注解
如:
```
@Around("aApplogic() && @annotation(annotation")
public Object invoke(ProceedingJoinPoint pjp,Annotation annotation){...}
```
### How to reproduce it (as minimally and precisely as possible)

1.
2.
3.

### Tell us your environment

### Anything else we need to know?

Contributor guide

Open the contributing guide

Research direction

Locate SentinelResourceAspect.invokeResourceWithSentinel() and inspect how ProceedingJoinPoint resolves the target method annotation. Compare that behavior with the annotation binding shown in the issue, including an interface method on a Retrofit-generated proxy. Done means SentinelResource annotations on those interface methods can be obtained reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.