1. 加入配置文件server.properties

DataCenter=beijing
ClusterName=demo
LocalName=xiaoming
ZeromqPath=/Volumes/workspace/yundiz/cloud.cluster/lib/zeromq/

DebugMode=TRUE
EnableDubbo=TRUE

#etcd地址
DebugEtcdEndPoint=http://192.168.6.72:2379
#zookeeper地址
DebugZooConnectString=192.168.6.1:2181


# 应用名
dubbo.application.name=cloud.pass
# 注册中心地址
dubbo.registry.address=192.168.6.1:2181
dubbo.registry.protocol=zookeeper
# 调用协议地址
dubbo.protocol.name=dubbo

2. 微服务api方式调用服务


import org.x3.config.Const;
import org.x3.rpc.Service;
import org.x3.rpc.ServiceDict;

import static org.junit.Assert.assertEquals;


public class ClientMain {
    public static void main(String[] args) {
        //初始化服务字典
        ServiceDict.init();
        HelloService helloService = Service.use(Const.NodeType.appserver).http().api(HelloService.class);
        Person result2 = helloService.getPerson("star");
    }
}

results matching ""

    No results matching ""