forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish apache#6173 : [Feature] Adding the "services" attribute into <…
…dubbo:reference> element
- Loading branch information
1 parent
36e21ca
commit 7b03172
Showing
4 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...java/org/apache/dubbo/config/spring/samples/ZookeeperDubboSpringConsumerXmlBootstrap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.dubbo.config.spring.samples; | ||
|
||
import org.apache.dubbo.config.spring.api.DemoService; | ||
|
||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
/** | ||
* Zookeeper Dubbo Spring Provider XML Bootstrap | ||
* | ||
* @since 2.7.8 | ||
*/ | ||
public class ZookeeperDubboSpringConsumerXmlBootstrap { | ||
|
||
public static void main(String[] args) throws Exception { | ||
String location = "classpath:/META-INF/service-introspection/zookeeper-dubbo-consumer.xml"; | ||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(location); | ||
|
||
DemoService demoService = context.getBean("demoService", DemoService.class); | ||
|
||
for (int i = 0; i < 100; i++) { | ||
System.out.println(demoService.sayName("Hello")); | ||
} | ||
|
||
context.close(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...fig-spring/src/test/resources/META-INF/service-introspection/zookeeper-dubbo-consumer.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo" | ||
xmlns="http://www.springframework.org/schema/beans" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd | ||
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"> | ||
|
||
<!-- 当前应用信息配置 --> | ||
<dubbo:application name="zookeeper-dubbo-spring-consumer"/> | ||
|
||
<!-- 连接注册中心配置 --> | ||
<dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service" use-as-config-center="true" | ||
use-as-metadata-center="true"/> | ||
|
||
<dubbo:reference id="demoService" interface="org.apache.dubbo.config.spring.api.DemoService" | ||
services="zookeeper-dubbo-spring-provider,zookeeper-dubbo-spring-provider"/> | ||
|
||
</beans> |