对springbean的方法使用@Cached注解导致获取spingbean上的自定义注解获取不到
- Dominant language
- Java
- Stars
- 5.6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
我有一个类
@Compoent
@Api //这是自定义注解
public class APerson implements Person {
@Cached(cacheType = CacheType.LOCAL,key = "params[areaCode]",expire = 120)
public void service() {
}
}
然后我业务是在spring启动后会扫描标有Api注解的类
Map classes = event.getApplicationContext().getBeansWithAnnotation(Api.class);
现在问题是 classes 里面获取到了对应的类,但因为是代理类 所以获取的annotation是null
去掉@Cached就好了
这是冲突吗
Contributor guide
No contributing guide indexed for this repository
Research direction
The report uses Spring's ApplicationContext.getBeansWithAnnotation(Api.class) and a @Cached method on a @Component; begin by reproducing the scan with and without @Cached and inspect the resulting proxy. No repository file or test is named, so locate the bean and proxy handling around that scan. Done means the custom Api annotation remains discoverable when @Cached is present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100