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

DubboConfig optimise

上级 9e337c2e
......@@ -15,9 +15,11 @@ public class DubboConfig {
* 配置文件里配置默认的,这里配置其他需要的
*/
@Bean("otherRegistry")
public RegistryConfig otherRegistry(@Value("${registry.other.address}") String address,
@Value("${registry.other.id}") String id) {
public RegistryConfig otherRegistry(@Value("${registry.other.protocol}") String protocol,
@Value("${registry.other.address}") String address,
@Value("${registry.other.id}") String id) {
RegistryConfig registry = new RegistryConfig();
registry.setProtocol(protocol);
registry.setAddress(address);
registry.setId(id);
return registry;
......
......@@ -4,7 +4,8 @@ spring:
dubbo:
registry:
address: zookeeper://127.0.0.1:2181
protocol: zookeeper
address: 127.0.0.1:2181
id: my-registry
protocol:
port: 20882
......@@ -18,5 +19,6 @@ dubbo:
registry:
other:
address: zookeeper://127.0.0.1:2181
protocol: zookeeper
address: 127.0.0.1:2181
id: other
......@@ -12,6 +12,5 @@ import org.springframework.context.annotation.ComponentScan;
public class ProviderApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(ProviderApplication.class, args);
// System.in.read();
}
}
......@@ -15,9 +15,11 @@ public class DubboConfig {
* 配置文件里配置默认的,这里配置其他需要的
*/
@Bean("otherRegistry")
public RegistryConfig otherRegistry(@Value("${registry.other.address}") String address,
@Value("${registry.other.id}") String id) {
public RegistryConfig otherRegistry(@Value("${registry.other.protocol}") String protocol,
@Value("${registry.other.address}") String address,
@Value("${registry.other.id}") String id) {
RegistryConfig registry = new RegistryConfig();
registry.setProtocol(protocol);
registry.setAddress(address);
registry.setId(id);
return registry;
......
......@@ -4,7 +4,8 @@ spring:
dubbo:
registry:
address: zookeeper://127.0.0.1:2181
protocol: zookeeper
address: 127.0.0.1:2181
id: my-registry
protocol:
port: 20882
......@@ -29,5 +30,6 @@ management:
registry:
other:
address: zookeeper://127.0.0.1:2181
protocol: zookeeper
address: 127.0.0.1:2181
id: other
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册