Wrong state for SentinelResource annotation
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
Type: *bug report*
### Describe what happened (or what feature you want)
when i try to apply SentinelResource on single method under FeignClient
```
@FeignClient(name = "local-remote-service", url = "http://127.0.0.1:8080/v2")
public interface RemoteService {
@GetMapping("/hello")
@SentinelResource(value = "testFail")
String getWord();
}
```
then exception throw
```
java.lang.IllegalStateException: Wrong state for SentinelResource annotation
at com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect.invokeResourceWithSentinel(SentinelResourceAspect.java:49) ~[sentinel-annotation-aspectj-1.8.4.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_321]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_321]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_321]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_321]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634) ~[spring-aop-5.3.18.jar:5.3.18]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624) ~[spring-aop-5.3.18.jar:5.3.18]
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72) ~[spring-aop-5.3.18.jar:5.3.18]
```
### Describe what you expected to happen
**does this solution can be supported?**
### Tell us your environment
```
com.alibaba.cloud
spring-cloud-starter-alibaba-sentinel
2.2.8.RELEASE
```
### Anything else we need to know?
#74
Contributor guide
Research direction
Start at SentinelResourceAspect.java line 49, where the reported IllegalStateException is raised, and reproduce the FeignClient example with the listed spring-cloud-starter-alibaba-sentinel dependency. Determine whether SentinelResource is intended to support this usage, then document the expected behavior and add a regression test if support is confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100