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

商务网站开发公司2021网页qq登陆

商务网站开发公司,2021网页qq登陆,一般什么行业做网站的多,怎样做一元购网站1. 项目结构假设项目分为三个模块#xff1a;api#xff1a;定义服务接口provider#xff1a;服务提供者consumer#xff1a;服务消费者2. 依赖配置在 pom.xml 中添加 Dubbo 和注册中心#xff08;如 Nacos#xff09;的依赖#xff1a;dependencygroupIdapi定义服务接口provider服务提供者consumer服务消费者2. 依赖配置在 pom.xml 中添加 Dubbo 和注册中心如 Nacos的依赖 dependencygroupIdorg.apache.dubbo/groupIdartifactIddubbo-spring-boot-starter/artifactIdversion3.0.2/version /dependency dependencygroupIdcom.alibaba.nacos/groupIdartifactIdnacos-client/artifactIdversion2.0.3/version /dependency3. 定义服务接口api 模块创建一个服务接口 package com.example.api;public interface HelloService {String sayHello(String name); }4. 服务提供者provider 模块4.1 实现服务接口 package com.example.provider;import com.example.api.HelloService; import org.apache.dubbo.config.annotation.Service;Service(version 1.0.0) public class HelloServiceImpl implements HelloService {Overridepublic String sayHello(String name) {return Hello, name;} }4.2 配置 Dubbo在 application.properties 中配置 Dubbo 和注册中心properties dubbo.application.namehello-service-provider dubbo.registry.addressnacos://127.0.0.1:8848 dubbo.protocol.namedubbo dubbo.protocol.port208805. 服务消费者consumer 模块5.1 引用服务接口在 application.properties 中配置 Dubbo 和注册中心properties dubbo.application.namehello-service-consumer dubbo.registry.addressnacos://127.0.0.1:88485.2 调用服务 package com.example.consumer;import com.example.api.HelloService; import org.apache.dubbo.config.annotation.Reference; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController;RestController public class HelloController {Reference(version 1.0.0)private HelloService helloService;GetMapping(/sayHello)public String sayHello(RequestParam String name) {return helloService.sayHello(name);} }6. 启动项目启动 Nacos 注册中心。启动服务提供者模块provider。启动服务消费者模块consumer。访问 http://localhost:8080/sayHello?nameKimi即可看到返回结果。7. 泛化调用示例可选如果需要泛化调用可以在消费者端使用 GenericService package com.example.consumer;import org.apache.dubbo.config.ReferenceConfig; import org.apache.dubbo.rpc.service.GenericService;public class GenericConsumer {public static void main(String[] args) {ReferenceConfigGenericService reference new ReferenceConfig();reference.setInterface(com.example.api.HelloService);reference.setGeneric(true);GenericService genericService reference.get();String result genericService.$invoke(sayHello, new String[]{java.lang.String}, new Object[]{Kimi});System.out.println(result);} }泛化调用不需要提前知道服务接口的具体定义。通过以上步骤可以实现一个完整的 Dubbo 服务调用案例
http://www.zqtcl.cn/news/902994/

相关文章:

  • 网站定位与功能分析在互联网公司做网站
  • 安阳网站建设兼职做网站推广有哪些公司
  • 网站制作的一般过程怎么用手机搭建网站
  • 备案 网站名称 怎么改深圳建网站公司
  • html 企业网站模板网站策划书免费
  • 网站建设销售ppt拖拽建站系统源码
  • 网站托管费用多少网站的开发流程
  • 周到的商城网站建设北京品牌网站
  • 网站开发费用属于什么科目网站建设考试多选题
  • c asp做网站wordpress4.5.2文章采集
  • 百度网站建设电话建立网站站建设可以吗
  • 网站后台代码在哪修改网站如何做下一页
  • 网站开发职业要求百度推广代理商与总公司的区别
  • 西安网站建设中心网页 网 址网站区别
  • 技术支持东莞网站建设机械seo岗位是什么意思
  • 做商城网站需要备案什么域名硬件开发工具有哪些
  • 网络网站制作技巧wordpress全文
  • 韩国原生ip站群服务器左右悬停代码网站
  • 专门做广东11选5的网站网站 备案 营业执照
  • 免费扑克网站wordpress弹出服务协议窗口
  • 网站的反爬一般怎样做网站右键屏蔽
  • 茂名做网站dyiee青岛宣传片制作公司
  • 凡科网可以自己做网站吗编程常用网站
  • 做网站练手项目公司营业执照可以做几个网站
  • 聚通达网站建设网站并发要求
  • 网站建设预算申请如何写服装店网页设计素材
  • 做网站设计的公司柳州芜湖又出现一例
  • 重庆网站网站建设东莞市网站建设公司哪家好
  • php做网站如何架构wordpress 排版
  • wordpress免费网站模板下载地址在北京注册公司需要多少钱