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

红色大气网站网站开发流程图工具

红色大气网站,网站开发流程图工具,给被k的网站做友链,在哪些网站做推广简单的Spring Cloud应用程序使用ZooKeeper作为注册中心的示例#xff1a; 1.新建模块#xff1a; 2.勾选依赖#xff1a; 3.在pom.xml文件中做出部分修改及添加Spring Cloud Zookeeper 依赖版本#xff1a; 完整pom文件 ?xml version1.0 encoding 1.新建模块 2.勾选依赖 3.在pom.xml文件中做出部分修改及添加Spring Cloud Zookeeper 依赖版本 完整pom文件 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion3.2.2/versionrelativePath/ !-- lookup parent from repository --/parent!-- Generated by https://start.springboot.io --!-- 优质的 spring/boot/data/security/cloud 框架中文文档尽在 https://springdoc.cn --groupIdcom.example/groupIdartifactIdZooKeeper/artifactIdversion0.0.1-SNAPSHOT/versionnameZooKeeper/namedescriptionDemo project for Spring Boot/descriptionpropertiesjava.version1.8/java.versionzookeeper.version2.2.5.RELEASE/zookeeper.version/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-webflux/artifactId/dependencydependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-zookeeper-config/artifactIdversion${zookeeper.version}/version/dependencydependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-zookeeper-discovery/artifactIdversion${zookeeper.version}/version/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependencydependencygroupIdio.projectreactor/groupIdartifactIdreactor-test/artifactIdscopetest/scope/dependency/dependenciesdependencyManagementdependencies/dependencies/dependencyManagementbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/build/project 4.配置ZooKeeper连接在application.yml文件中配置ZooKeeper的连接字符串。 spring:application:name: productcloud:zookeeper:connect-string: localhost:2181 server:port: 8101 5.新增Controller: package com.example.zookeeperserver;import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;RestController RequestMapping public class ProductController {GetMapping(product)public String product(){return this is product;} }package com.example.zookeeper;import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController;import java.util.List;RestController public class ServiceController {Autowiredprivate DiscoveryClient discoveryClient;/*** Description:通过注入DiscoveryClient实例来获取服务实例的信息* Author: * Date: 2024/2/7 15:46* return: java.util.Listjava.lang.String* 访问地址http://localhost:8101/services**/GetMapping(/services)public ListString getServices(){//返回所有注册到服务发现中心的服务名称return discoveryClient.getServices();}/*** Description:* Author: * Date: 2024/2/7 15:52* param serviceName:* return: java.util.Listorg.springframework.cloud.client.ServiceInstance* 访问地址http://localhost:8101/serviceInstances/product**/GetMapping(/serviceInstances/{serviceName})public ListServiceInstance getServiceInstance(PathVariable String serviceName){//getServiceInstances方法接受一个服务名称作为参数返回该服务的所有实例。//每个ServiceInstance对象包含了服务实例的详细信息如主机名、端口号等return discoveryClient.getInstances(serviceName);}} 6.启动本地的服务端 7.启动服务注册和发现在主应用类中通过EnableDiscoveryClient注解启用服务注册和发现 8.访问localhost:8101/product 完整项目代码
http://www.hkea.cn/news/14294018/

相关文章:

  • 山东济南城乡建设厅网站百度云电脑网页版入口
  • 怎么修改网站的关键词页面做的比较炫酷的网站
  • js判断是手机还是电脑访问网站品牌营销策划案例ppt
  • 设计素材网站哪个最好推荐酒店网站方案
  • 房地产型网站建设报价有什么做数据的网站
  • 重庆企业网站推广方法优化新十条
  • 网站可以用中国二字做抬头吗建设公司网站多少钱
  • 网站建设基本内容宣讲家网站生态文明建设
  • 成都网站建设时代汇创个人简历简短范文
  • 网站建设发货流程图合肥网站建设培训中心
  • 西安建站平台哪个好gta5网站建设中
  • 西安最新招聘信息广州seo工作室
  • 网站动态logo怎么做电子商务网站规划的内容
  • 厦门网站流量优化价格东莞新闻头条新闻今天
  • 公司网站开发外包公司网站排版怎么做
  • 电商网站设计思路北京的做网站的公司
  • 银联支付网站建设m3u8视频可以永久保存吗
  • 门户网站建设的成果怎么给制作网站谷歌地图
  • 网络营销网站分析没有自己的网站做百度竞价
  • 学做网站论坛vip账号传奇页游什么好玩
  • 网站开发的试题厂房建设公司哪家好
  • 网站首页页面设计公司网址有哪些
  • 企业产品展示网站源码哈尔滨网站域名备案
  • 贵阳网站定制开发wordpress如何实现用户注册
  • 中国查企业的网站企业名录2021版
  • 高效网站推广石家庄网站建设教程
  • 做购物网站赚钱吗珠海网站关键词排名服务商
  • 网站关于我们示例宁波外贸公司排名2022
  • 良品铺子网站规划和建设中兴建设 基金管理有限公司网站
  • 智慧城市网站建设长沙室内设计工作室