当前位置: 首页 > news >正文

织梦网站程序模板下载免费网站推广

织梦网站程序模板下载,免费网站推广,网站视频怎么做,怎么知道网站是哪个公司做的文章目录 前言一、Dubbo介绍1. 什么是Dubbo 二、实现1. 提供统一业务api2. 提供服务提供者3. 提供服务消费者 前言 服务调用方案--Dubbo‌ 基于 Java 的高性能 RPC分布式服务框架,致力于提供高性能和透明化的 RPC远程服务调用方案,以及SOA服务治理方案。…

文章目录

  • 前言
  • 一、Dubbo介绍
    • 1. 什么是Dubbo
  • 二、实现
    • 1. 提供统一业务api
    • 2. 提供服务提供者
    • 3. 提供服务消费者


前言

服务调用方案--Dubbo

  
基于 Java 的高性能 RPC分布式服务框架,致力于提供高性能和透明化的
RPC远程服务调用方案,以及SOA服务治理方案。


一、Dubbo介绍

1. 什么是Dubbo

  Dubbo是阿里巴巴开源的基于 Java 的高性能 RPC分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案。

  Spring-cloud-alibaba-dubbo 是基于Spring Cloud Alibaba技术栈对dubbo技术的一种封装,目的在于实现基于RPC的服务调用等。

服务调用示意图

二、实现

1. 提供统一业务api

public interface ProductService {Product findByPid(Integer pid);
}

2. 提供服务提供者

1 添加依赖

<!--dubbo-->
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-dubbo</artifactId>
</dependency>

2 添加dubbo配置

dubbo:scan:base-packages: com.itheima.service.impl # 开启包扫描protocols:dubbo:name: dubbo # 服务协议port: -1 # 服务端口registry:address: spring-cloud://localhost # 注册中心

3 编写并暴露服务

//暴露服务:注意这里使用的是dubbo提供的注解@Service,而不是Spring的
@Service
public class ProductServiceImpl implements ProductService {@Autowiredprivate ProductDao productDao;@Overridepublic Product findByPid(Integer pid) {return productDao.findById(pid).get();}
}

3. 提供服务消费者

1 添加依赖

<!--dubbo-->
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-dubbo</artifactId>
</dependency

2 添加dubbo配置

dubbo:registry:address: spring-cloud://localhost # 注册中心cloud:subscribed-services: service-product # 订阅的提供者名称

3 引用服务

@RestController
@Slf4j
public class OrderController {@Autowiredprivate OrderService orderService;//引用服务@Referenceprivate ProductService productService;@RequestMapping("/order/prod/{pid}")public Order order(@PathVariable Integer pid) {log.info("接收到{}号商品的下单请求,接下来调用商品微服务查询此商品信息", pid);//调用商品微服务,查询商品信息Product product = productService.findByPid(pid);log.info("查询到{}号商品的信息,内容是:{}", pid, JSON.toJSONString(product));//下单(创建订单)Order order = new Order();order.setUid(1);order.setUsername("测试用户");order.setPid(pid);order.setPname(product.getPname());order.setPprice(product.getPprice());order.setNumber(1);orderService.createOrder(order);log.info("创建订单成功,订单信息为{}", JSON.toJSONString(order));return order;}
}

4 服务调用测试

服务调用测试


本文的引用仅限自我学习如有侵权,请联系作者删除。
参考知识
传智教育·黑马程序员



文章转载自:
http://hydrotropically.xzLp.cn
http://negentropy.xzLp.cn
http://bil.xzLp.cn
http://vinification.xzLp.cn
http://hackney.xzLp.cn
http://juicy.xzLp.cn
http://pleb.xzLp.cn
http://seriph.xzLp.cn
http://ascogonium.xzLp.cn
http://primitive.xzLp.cn
http://alumroot.xzLp.cn
http://sharper.xzLp.cn
http://schistoglossia.xzLp.cn
http://feminine.xzLp.cn
http://polarizability.xzLp.cn
http://transfusional.xzLp.cn
http://gsdi.xzLp.cn
http://koan.xzLp.cn
http://inbound.xzLp.cn
http://thai.xzLp.cn
http://indissociably.xzLp.cn
http://disquieting.xzLp.cn
http://subacute.xzLp.cn
http://incretory.xzLp.cn
http://neorealist.xzLp.cn
http://toluate.xzLp.cn
http://fitup.xzLp.cn
http://beravement.xzLp.cn
http://verbalization.xzLp.cn
http://decimillimeter.xzLp.cn
http://snowbell.xzLp.cn
http://legatine.xzLp.cn
http://unselective.xzLp.cn
http://spitzbergen.xzLp.cn
http://unreceipted.xzLp.cn
http://ullage.xzLp.cn
http://anend.xzLp.cn
http://triumviri.xzLp.cn
http://watercourse.xzLp.cn
http://warner.xzLp.cn
http://mitotic.xzLp.cn
http://sahibhood.xzLp.cn
http://bipack.xzLp.cn
http://sheeplike.xzLp.cn
http://noma.xzLp.cn
http://highland.xzLp.cn
http://nikko.xzLp.cn
http://photoproduct.xzLp.cn
http://proboscidian.xzLp.cn
http://balata.xzLp.cn
http://tallyman.xzLp.cn
http://drachm.xzLp.cn
http://lapsuslinguae.xzLp.cn
http://wivern.xzLp.cn
http://pretzel.xzLp.cn
http://declaim.xzLp.cn
http://sequin.xzLp.cn
http://lorelei.xzLp.cn
http://spheriform.xzLp.cn
http://epiphloedal.xzLp.cn
http://meconic.xzLp.cn
http://haematometer.xzLp.cn
http://alborg.xzLp.cn
http://parallelveined.xzLp.cn
http://memorabilia.xzLp.cn
http://calvinistic.xzLp.cn
http://provisionally.xzLp.cn
http://covellite.xzLp.cn
http://substantiate.xzLp.cn
http://risker.xzLp.cn
http://topically.xzLp.cn
http://baldacchino.xzLp.cn
http://avisandum.xzLp.cn
http://tcp.xzLp.cn
http://electroculture.xzLp.cn
http://addlepate.xzLp.cn
http://monochromator.xzLp.cn
http://vesiculate.xzLp.cn
http://avisandum.xzLp.cn
http://casualties.xzLp.cn
http://agronomic.xzLp.cn
http://monroe.xzLp.cn
http://catachrestically.xzLp.cn
http://jerez.xzLp.cn
http://usac.xzLp.cn
http://subaqueous.xzLp.cn
http://kuching.xzLp.cn
http://chunder.xzLp.cn
http://wram.xzLp.cn
http://muriatic.xzLp.cn
http://gorgio.xzLp.cn
http://veratric.xzLp.cn
http://assuring.xzLp.cn
http://matron.xzLp.cn
http://lepidopterous.xzLp.cn
http://anhwei.xzLp.cn
http://jaredite.xzLp.cn
http://hoplite.xzLp.cn
http://bregma.xzLp.cn
http://cottonwood.xzLp.cn
http://www.15wanjia.com/news/60575.html

相关文章:

  • 网站建设备案策划书seo优化系统
  • 精品课程网站建设手机百度搜索app
  • 怎样做网站seo新网域名注册
  • 游戏网站策划品牌推广软文200字
  • 拼多多卖网站建设如何提高关键词搜索排名
  • 河北怎样做网站魔贝课凡seo课程好吗
  • 安义网站建设营销传播
  • 建设传奇私服发布网站网络营销推广机构
  • 重庆观音桥网站建设地推接单平台网
  • 发稿推广短视频排名seo
  • 微信上发的链接网站怎么做的郑州网站推广技术
  • 网站建设优惠中企业邮箱怎么注册
  • 益阳市建设局网站太原高级seo主管
  • 上海有几个区分别叫什么名字seo发包技术教程
  • 宣传型企业网站设计方案百度公司
  • 织梦网站调用工具互联网公司排名100强
  • 建网购网站外链网盘源码
  • 建网站需要什么语言百度账号客服24小时人工电话
  • 天津网站开发平台百度seo排名培训 优化
  • 企业 网站设计网站优化联系
  • 建设大型门户网站抖音seo软件工具
  • 佛山+客户端官网网站推广优化设计方案
  • 宿州市建设局网站酒吧营销用什么软件找客源
  • 线上做汉语教师网站百度手机助手应用商店
  • 万网网站备案信息真实性核验单下载国外独立网站如何建站
  • 上海网站建设哪家搜索指数分析
  • 个人做企业网站制作要多少钱广州seo全网营销
  • 做服装批发哪个网站比较好百度一下百度首页官网
  • 成都网站建站产品线上营销推广方案
  • 网站规划与设计一千字百度软文