提交 c267f25f 编写于 作者: 武汉红喜's avatar 武汉红喜

DubboConfig optimise

上级 7de3583f
......@@ -13,14 +13,13 @@ public class DubboConfig {
/**
* 配置文件里配置默认的,这里配置其他需要的
* @param otherZK
* @return
*/
@Bean("otherZK")
public RegistryConfig registryConfig(@Value("${registry.zk.other}") String otherZK) {
@Bean("otherRegistry")
public RegistryConfig otherRegistry(@Value("${registry.other.address}") String address,
@Value("${registry.other.id}") String id) {
RegistryConfig registry = new RegistryConfig();
registry.setId("otherZK");
registry.setAddress(otherZK);
registry.setAddress(address);
registry.setId(id);
return registry;
}
}
......@@ -15,7 +15,7 @@ public class DemoRpc {
@Reference(version = "1.0.0")
private DemoService demoService;
@Reference(version = "1.0.0", registry = "otherZK")
@Reference(version = "1.0.0", registry = "otherRegistry")
private OtherService otherService;
public String sayHello(String name) {
......
......@@ -17,5 +17,6 @@ dubbo:
qosPort: 22224
registry:
zk:
other: zookeeper://127.0.0.1:2181
other:
address: zookeeper://127.0.0.1:2181
id: other
......@@ -13,14 +13,13 @@ public class DubboConfig {
/**
* 配置文件里配置默认的,这里配置其他需要的
* @param otherZK
* @return
*/
@Bean("otherZK")
public RegistryConfig registryConfig(@Value("${registry.zk.other}") String otherZK) {
@Bean("otherRegistry")
public RegistryConfig otherRegistry(@Value("${registry.other.address}") String address,
@Value("${registry.other.id}") String id) {
RegistryConfig registry = new RegistryConfig();
registry.setId("otherZK");
registry.setAddress(otherZK);
registry.setAddress(address);
registry.setId(id);
return registry;
}
}
......@@ -16,7 +16,7 @@ import java.util.Date;
version = "1.0.0",
application = "${dubbo.application.id}",
protocol = "${dubbo.protocol.id}",
registry = "otherZK"
registry = "otherRegistry"
)
public class OtherServiceImpl implements OtherService {
......
......@@ -28,5 +28,6 @@ management:
enabled: false
registry:
zk:
other: zookeeper://127.0.0.1:2181
other:
address: zookeeper://127.0.0.1:2181
id: other
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册