dubbo-website icon indicating copy to clipboard operation
dubbo-website copied to clipboard

用户示例-多协议-增加默认协议示例

Open xiaoed opened this issue 4 years ago • 0 comments

不同服务不同协议

设置默认协议

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
    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="world"  />
    <dubbo:registry id="registry" address="10.20.141.150:9090" username="admin" password="hello1234" />
    <!-- 多协议配置 -->
    <dubbo:protocol name="dubbo" port="20880" />
    <dubbo:protocol name="rmi" port="1099" default="false"/> <!-- 不配置default参数,rmi也是默认协议 -->
    <!-- 使用默认协议暴露服务 -->
    <dubbo:service interface="com.alibaba.hello.api.HelloService1" version="1.0.0" ref="helloService1" /> <!-- 省略protocol配置 -->
    <dubbo:service interface="com.alibaba.hello.api.HelloService2" version="1.0.0" ref="helloService2" />
    <!-- 使用rmi协议暴露服务 -->
    <dubbo:service interface="com.alibaba.hello.api.DemoService" version="1.0.0" ref="demoService" protocol="rmi" /> 
</beans>

xiaoed avatar Dec 03 '21 03:12 xiaoed