* Dubbo version: 2.7.2
* Java version: 1.8

Code:
public static <T> T getBeanByGroup(Class<T> bean, String group) throws 
RuntimeException {
                T service = null;
                try {
               // 引用远程服务
                ReferenceConfig<T> reference = new ReferenceConfig<T>();
                        reference.setInterface(bean);
                        // reference.setVersion("");
                        // 服务分组
                        if (!StringUtil.isEmpty(group)) {
                                reference.setGroup(group);
                        }
                        // 当前消费者应用配置
                        ApplicationConfig application = new 
ApplicationConfig(getAppName());
                        reference.setApplication(application);
                        reference.setRegistry(registry);
                        // 缓存reference实例
                        ReferenceConfigCache referenceConfigCache =    
ReferenceConfigCache.getCache();
                        service =  referenceConfigCache.get(reference);
                } catch (Exception e) {
                        throw new RuntimeException(e.getMessage());
                }
                return service;
        }

Appearance:
<img width="1435" alt="image" 
src="https://user-images.githubusercontent.com/8829397/63080215-21c1bd00-bf73-11e9-8c99-0bd6afbf04c2.png";>



[ Full content available at: https://github.com/apache/dubbo/issues/4833 ]
This message was relayed via gitbox.apache.org for 
notifications@dubbo.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to