Open whthomas opened 8 years ago
如果是使用xml的配置方式可以通过
@Autowired Map<String, ReferenceBean> references;
获取所有的client服务代理。
如果是使用@Reference好像就没有办法获取这些ReferenceBean了。
AnnotationBean这个类里面把ReferenceBean相关的属性使用了private,导致无法获取这些实例
AnnotationBean
ReferenceBean
private
private final ConcurrentMap<String, ReferenceBean<?>> referenceConfigs = new ConcurrentHashMap<String, ReferenceBean<?>>();
从context里面获取到保存所有Bean的Map,然后便利所有Bean中的所有方法。 如果方法的Annotation适配为@Reference的类型,则将该Bean记录下来 Method[] methods = UsingAnno.class.getMethods(); Annotation[] anno = method.getAnnotations();
不过效率比较低
如果是使用xml的配置方式可以通过
获取所有的client服务代理。
如果是使用@Reference好像就没有办法获取这些ReferenceBean了。
AnnotationBean
这个类里面把ReferenceBean
相关的属性使用了private
,导致无法获取这些实例