您的位置:首页 > 其它

dubbox的生产者与消费者

2020-02-03 00:32 78 查看

动手能力

动手能力很重要

dubbox生产者

<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">


    <dubbo:protocol name="dubbo" port="20890"></dubbo:protocol>
<dubbo:application name="service"/>  
    <dubbo:registry address="zookeeper://192.168.227.131:2181"/>
    <dubbo:annotation package="com.service.impl" />  
   
   

</beans>

dubbox消费者

<?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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    <context:property-placeholder location="classpath:config/application.properties" />

<mvc:annotation-driven>
  <mvc:message-converters register-defaults="true">
    <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">  
      <property name="supportedMediaTypes" value="application/json"/>
      <property name="features">
        <array>
          <value>WriteMapNullValue</value>
          <value>WriteDateUseDateFormat</value>
        </array>
      </property>
    </bean>
  </mvc:message-converters>  
</mvc:annotation-driven>


<!-- 引用dubbo 服务 -->
<dubbo:application name="controller" />
<dubbo:registry address="zookeeper://192.168.227.131:2181"/>
<dubbo:annotation package="com.controller" /> 


</beans>

  • 点赞
  • 收藏
  • 分享
  • 文章举报
lyp950510 发布了1 篇原创文章 · 获赞 0 · 访问量 426 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: