DBUUO相关配置代码介绍
来源:互联网 发布:淘宝开店在哪里拿货 编辑:程序博客网 时间:2024/05/16 04:51
相关代码介绍---生产者
zookeeper使用需要有消费者和生产者,生产者提供制定的接口内容后,消费者才可以使用;
<?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://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!-- 提供方应用名称信息,这个相当于起一个名字,我们dubbo管理页面比较清晰是哪个应用暴露出来的 --> <dubbo:application name="dubbo_provider"></dubbo:application> <!-- 使用zookeeper注册中心暴露服务地址 --> <dubbo:registry address="zookeeper://127.0.0.1:2181" check="false" subscribe="false" register=""></dubbo:registry> <!-- 要暴露的服务接口 --> <dubbo:service interface="com.zooker.RegistryService" ref="testRegistryService" /></beans>
dubbo:registry address="zookeeper://127.0.0.1:2181"
表示注册地址;zookeeper在项目启动的时候,将会对连接该地址;dubbo:service
表示注册的接口内容;其中ref="testRegistryService"
是需要在spring配置文件配置的,依获取对象;<bean id="testRegistryService" class="com.zooker.impl.RegistryServiceImpl"></bean>
spring中注入的内容 ;该对象对了的class是个实体类
消费者
做为消费者,需要知道从何处获取到zookeeper提供的接口;其次,将这些接口引入到自身的服务器中;
<?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:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.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-3.1.xsd" default-lazy-init="false" > <dubbo:application name="dubbo_consumer"></dubbo:application> <!-- 使用zookeeper注册中心暴露服务地址 --> <dubbo:registry address="zookeeper://127.0.0.1:2181" check="false"></dubbo:registry> <!-- 要引用的服务 --> <dubbo:reference interface="com.zooker.RegistryService" id="registryService"></dubbo:reference></beans>
dubbo:registry address="zookeeper://127.0.0.1:2181"
表示生产者获取接口的地址;dubbo:reference interface="com.zooker.RegistryService" id="registryService"
从zookeeper中获取的接口对象;
@Autowired RegistryService registryService;
在java中只需要将在配置在xml文件中的id对象;即id="registryService"
添加到对象当中即可 zookeeper 会自动的帮助你找的应该实例化的对象;
相关代码介绍---生产者
zookeeper使用需要有消费者和生产者,生产者提供制定的接口内容后,消费者才可以使用;
<?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://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <!-- 提供方应用名称信息,这个相当于起一个名字,我们dubbo管理页面比较清晰是哪个应用暴露出来的 --> <dubbo:application name="dubbo_provider"></dubbo:application> <!-- 使用zookeeper注册中心暴露服务地址 --> <dubbo:registry address="zookeeper://127.0.0.1:2181" check="false" subscribe="false" register=""></dubbo:registry> <!-- 要暴露的服务接口 --> <dubbo:service interface="com.zooker.RegistryService" ref="testRegistryService" /></beans>
dubbo:registry address="zookeeper://127.0.0.1:2181"
表示注册地址;zookeeper在项目启动的时候,将会对连接该地址;dubbo:service
表示注册的接口内容;其中ref="testRegistryService"
是需要在spring配置文件配置的,依获取对象;<bean id="testRegistryService" class="com.zooker.impl.RegistryServiceImpl"></bean>
spring中注入的内容 ;该对象对了的class是个实体类
消费者
做为消费者,需要知道从何处获取到zookeeper提供的接口;其次,将这些接口引入到自身的服务器中;
<?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:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.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-3.1.xsd" default-lazy-init="false" > <dubbo:application name="dubbo_consumer"></dubbo:application> <!-- 使用zookeeper注册中心暴露服务地址 --> <dubbo:registry address="zookeeper://127.0.0.1:2181" check="false"></dubbo:registry> <!-- 要引用的服务 --> <dubbo:reference interface="com.zooker.RegistryService" id="registryService"></dubbo:reference></beans>
dubbo:registry address="zookeeper://127.0.0.1:2181"
表示生产者获取接口的地址;dubbo:reference interface="com.zooker.RegistryService" id="registryService"
从zookeeper中获取的接口对象;
@Autowired RegistryService registryService;
在java中只需要将在配置在xml文件中的id对象;即id="registryService"
添加到对象当中即可 zookeeper 会自动的帮助你找的应该实例化的对象;
- DBUUO相关配置代码介绍
- OpenCV相关代码库的介绍
- session有效期配置 相关介绍(上)
- session有效期配置 相关介绍(下)
- 【android】如何混淆代码和相关配置
- 代码混淆 proguard相关配置过程记录
- halcon程序生成C++代码相关配置
- [lcm] Qualcomm cabl 配置相关代码
- Oracle 字符串split的相关实际应用代码介绍
- 二分图与相关代码介绍(转)
- Python代码中os.path常见属性的相关介绍
- Android系统中与应用程序资源相关的代码介绍
- Git关于通过Xcode进行代码Merge的相关介绍
- tomcat目录与代码自动加载的相关介绍
- Nginx+PHP配置相关进程的简要介绍
- Linux 下 网络相关配置介绍,很详细的。
- struts2的常量配置以及常用常量的相关介绍
- nginx conf文件结构介绍以及相关配置
- pwnable 之echo2
- 面向对象设计原则概述
- 【openjudge】分成互质组
- Java线程同步详解
- Git学习笔记
- DBUUO相关配置代码介绍
- 主流操作系统分类及Linux系统简介
- PAT b1021-b1025题解
- Java实现:输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。
- oh-my-zsh powerline打造终极shell
- 视频雪花故障检测
- JBoss 中配置数据源(datasource)连接池
- 创建maven时 修改默认的servlet、jdk版本
- Sublime Text 3 快捷键汇总