第一步:下载
maven: https://maven.apache.org/download.cgi#
dubbox: https://github.com/dangdangdotcom/dubbox,
介绍:http://www.open-open.com/lib/view/open1417426480618.html
dubbox: 是一波大牛在dubbo的基础上的扩展,比如加入的rest,升级了spring版本等等。
下载:zookeeper 我这下载的3.4.6 http://apache.fayea.com/zookeeper/zookeeper-3.4.6/
eclipse:要装下maven插件。
第二部:安装
maven: 安装使用自己百度吧,其实就是配置下环境变量,修改下jar包的存放位置
dubbox:用CMD命令到解压出来的dubbox目录执行mvn install -Dmaven.test.skip=true来尝试编译一下dubbo(并将dubbo的jar安装到本地maven库),这样导入eclipse里面就可测试自带的demo了
zookeeper:解压之后到conf目录新建个zoo.cfg,其实就是zoo_sample.cfg上修改的,主要修改两个地方就行
1、# 存储内存中数据库快照的位置,如果不设置参数,更新事务日志将被存储到默认位置。
dataDir=D:\\apache-zookeeper-3.4.6\\dataDir
2、# 错误日志的存放位置
dataLogDir=D:\\apache-zookeeper-3.4.6\\dataLogDir
第三步用eclipse 创建自己的项目,这里我直接把我搭建的项目上传。大家可以自己看下
spring-dubbo-demo-provider.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 Alibaba Group.
-
- Licensed 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="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-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="demo-provider" owner="programmer" organization="dubbox"/>
<dubbo:registry protocol="zookeeper" file="C://Users/Administrator//dubbo//output//p1.cache" address="zookeeper://127.0.0.1:2181"/>
<!-- <dubbo:registry address="multicast://224.5.6.7:1234?unicast=false"/> -->
<!-- <dubbo:registry address="192.168.1.104:9090"/> -->
<!--uncomment this if you want to test dubbo's monitor-->
<!-- <dubbo:monitor protocol="registry"/> -->
<!-- here we demonstrate both annotation-based and xml-based configs -->
<dubbo:annotation package="com.alibaba.dubbo.demo.user.facade" />
<dubbo:protocol name="dubbo" serialization="kryo" optimizer="com.alibaba.dubbo.demo.SerializationOptimizerImpl" port="20880" />
<!--<dubbo:protocol name="dubbo" serialization="fst" optimizer="com.alibaba.dubbo.demo.SerializationOptimizerImpl"/>-->
<!--<dubbo:protocol name="dubbo" serialization="nativejava"/>-->
<!--<dubbo:protocol name="dubbo" serialization="hessian2"/>-->
<!--<dubbo:protocol name="dubbo" serialization="fastjson"/>-->
<!--<dubbo:protocol name="dubbo" serialization="dubbo"/>-->
<!--TODO according to the spring convention, we should use something like keep-alive-->
<!-- use netty server -->
<!--<dubbo:protocol name="rest" port="8888" keepalive="true" server="netty" iothreads="5" threads="100" contextpath="services"/>-->
<!-- use tjws server -->
<!--<dubbo:protocol name="rest" port="8888" server="tjws" contextpath="services"/>-->
<!-- use tomcat server -->
<dubbo:protocol name="rest" port="8888" threads="500" contextpath="services" server="tomcat" accepts="500"
extension="com.alibaba.dubbo.demo.extension.TraceInterceptor,
com.alibaba.dubbo.demo.extension.TraceFilter,
com.alibaba.dubbo.demo.extension.ClientTraceFilter,
com.alibaba.dubbo.demo.extension.DynamicTraceBinding,
com.alibaba.dubbo.demo.extension.CustomExceptionMapper,
com.alibaba.dubbo.rpc.protocol.rest.support.LoggingFilter"/>
<!-- use the external tomcat or other server with the servlet approach; the port and contextpath must be exactly the same as those in external server -->
<!--<dubbo:protocol name="rest" port="8888" contextpath="services" server="servlet"/>-->
<!-- <dubbo:protocol name="http" port="8889"/> -->
<!-- <dubbo:protocol name="hessian" port="8890"/> -->
<!-- <dubbo:protocol name="webservice" port="8892"/> -->
<dubbo:service interface="com.alibaba.dubbo.demo.bid.BidService" ref="bidService" protocol="dubbo"/>
<!-- we add the group property since there's another annotation-configured service impl: com.alibaba.dubbo.demo.user.facade.AnnotationDrivenUserRestServiceImpl -->
<dubbo:service interface="com.alibaba.dubbo.demo.user.UserService" ref="userService" protocol="dubbo" group="xmlConfig"/>
<dubbo:service interface="com.alibaba.dubbo.demo.user.facade.UserRestService" ref="userRestService" protocol="rest" validation="true"/>
<dubbo:service interface="com.alibaba.dubbo.demo.user.facade.AnotherUserRestService" ref="anotherUserRestService" protocol="rest" timeout="2000" connections="100" validation="true"/>
<bean id="bidService" class="com.alibaba.dubbo.demo.bid.BidServiceImpl" />
<bean id="userService" class="com.alibaba.dubbo.demo.user.UserServiceImpl" />
<bean id="userRestService" class="com.alibaba.dubbo.demo.user.facade.UserRestServiceImpl">
<property name="userService" ref="userService"/>
</bean>
<bean id="anotherUserRestService" class="com.alibaba.dubbo.demo.user.facade.AnotherUserRestServiceImpl">
<property name="userService" ref="userService"/>
</bean>
</beans>
spring-dubbo-demo-consumer.xml
<?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-3.2.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd" >
<dubbo:application name="opspeedc" owner="programmer" organization="dubbox"/>
<dubbo:registry protocol="zookeeper" file="C://Users/Administrator//dubbo//output//c1.cache" address="zookeeper://127.0.0.1:2181"/>
<!-- <dubbo:registry address="multicast://224.5.6.7:1234?unicast=false" /> -->
<!-- <dubbo:registry address="192.168.1.104:9090"/> -->
<!--uncomment this if you want to test dubbo's monitor-->
<!--<dubbo:monitor protocol="registry"/>-->
<dubbo:reference id="bidService" interface="com.alibaba.dubbo.demo.bid.BidService"/> <!-- sticky="true" -->
<dubbo:reference id="anotherUserRestService" interface="com.alibaba.dubbo.demo.user.facade.AnotherUserRestService"/>
<!-- directly connect to provider to simulate the access to non-dubbo rest services -->
<!-- <dubbo:reference id="anotherUserRestService" interface="com.alibaba.dubbo.demo.user.facade.AnotherUserRestService" url="rest://localhost:8888/services/"/> -->
</beans>
我消费者 和提供者 都是web项目 直接上传到附近,大家下载下来后倒入eclipse就可以跑了,
消费者是springMVC 解析器配置的jsp和freemarker。
分享到:
相关推荐
标题 "Springmvc+dubbo+mybatis+mysql+redis" 描述了一个基于Java技术栈的分布式微服务架构。在这个系统中,SpringMVC作为前端控制器处理HTTP请求,Dubbo用于服务治理,MyBatis是持久层框架,MySQL是关系型数据库,...
**Zookeeper** 是一个分布式的,开放源码的分布式应用程序协调服务,它是集群的管理者,监视着集群中各个节点的状态根据节点提交的反馈进行下一步合理操作。最终将简单易用的接口和性能高效、功能稳定的系统提供给...
技术选型 前端:angularJS + Bootstrap 后台:SSM( springmvc+spring+mybatis) 数据库:mysql,使用mycat读写分离 开发模式:SOA 服务中间件:dubbox,需要和zookeeper配合使用 注册中心:zookeeper 消息中间件:...
黑马49期全系列,包括品优购,yunpan地址,前端:angularJS + Bootstrap 后台:SSM( springmvc+spring+mybatis) 数据库:mysql 使用mycat读写分离 开发模式:SOA 服务中间件:dubbox,需要和zookeeper配合使用 ...
服务中间件:dubbox,需要和zookeeper配合使用 注册中心:zookeeper 消息中间件:Activemq,使用弹簧JMS 负载均衡:nginx的的 搜索:Solr中的集群(solrCloud),配合动物园管理员搭建,使用弹簧-数据-索洛 缓存:...
服务中间件:dubbox,需要和zookeeper配合使用 注册中心:zookeeper 消息中间件:Activemq,使用spring-jms 负载均衡:nginx 搜索:solr集群(solrCloud),配合zookeeper搭建, 使用spring-data-solor 缓存:redis...
09-SSH企业案例_CRM-客户管理系统(6天) ... day02_登录_客户管理模块 ...8Nginx反向代理与负载均衡 9品优购部署方案 10Docker简介 11Docker安装与启动 12Docker镜像操作 13Docker容器操作 14部署应用 15备份与迁移
- 传统的应用架构基于Dubbo、Spring、SpringMVC和MyBatis,这种架构在服务调用和问题定位上存在挑战。 - 随着业务的发展,项目迭代频繁,新业务尝试和并行度增加,对基础架构和交付方式提出了更高要求。 2. **...
3. **SSM(Spring、SpringMVC、MyBatis)和DubboX**:SSM是Java Web开发中的常见框架组合,用于构建后端服务。而DubboX是基于Dubbo的扩展,提供了更强大的服务治理能力,包括服务注册、发现、调用、负载均衡等。 4....
* 深入了解各种开源框架如 Spring、Zookeeper、MQ、Redis,精通精通 Spring、MyBatis * 扎实 JAVA 基础,熟悉常用设计模式并可应用于实际项目,熟悉高并发、高性能分布式系统设计及调优 * 精通 Mysql 数据库,有 ...