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

毕设做网站工作量够吗qq群推广

毕设做网站工作量够吗,qq群推广,卖产品的网站怎么做,如何提升网站营销力简单的Spring Cloud应用程序使用ZooKeeper作为注册中心的示例&#xff1a; 1.新建模块&#xff1a; 2.勾选依赖&#xff1a; 3.在pom.xml文件中做出部分修改及添加Spring Cloud Zookeeper 依赖版本&#xff1a; 完整pom文件 <?xml version"1.0" encoding&q…

简单的Spring Cloud应用程序使用ZooKeeper作为注册中心的示例:
1.新建模块:
在这里插入图片描述
2.勾选依赖:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
3.在pom.xml文件中做出部分修改及添加Spring Cloud Zookeeper 依赖版本

在这里插入图片描述
完整pom文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.2.2</version><relativePath/> <!-- lookup parent from repository --></parent><!-- Generated by https://start.springboot.io --><!-- 优质的 spring/boot/data/security/cloud 框架中文文档尽在 => https://springdoc.cn --><groupId>com.example</groupId><artifactId>ZooKeeper</artifactId><version>0.0.1-SNAPSHOT</version><name>ZooKeeper</name><description>Demo project for Spring Boot</description><properties><java.version>1.8</java.version><zookeeper.version>2.2.5.RELEASE</zookeeper.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webflux</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zookeeper-config</artifactId><version>${zookeeper.version}</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zookeeper-discovery</artifactId><version>${zookeeper.version}</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>io.projectreactor</groupId><artifactId>reactor-test</artifactId><scope>test</scope></dependency></dependencies><dependencyManagement><dependencies></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-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.List<java.lang.String>*     访问地址:http://localhost:8101/services**/@GetMapping("/services")public List<String> getServices(){//返回所有注册到服务发现中心的服务名称return discoveryClient.getServices();}/*** @Description:* @Author: * @Date: 2024/2/7 15:52* @param serviceName:* @return: java.util.List<org.springframework.cloud.client.ServiceInstance>*     访问地址:http://localhost:8101/serviceInstances/product**/@GetMapping("/serviceInstances/{serviceName}")public List<ServiceInstance> getServiceInstance(@PathVariable String serviceName){//getServiceInstances方法接受一个服务名称作为参数,返回该服务的所有实例。//每个ServiceInstance对象包含了服务实例的详细信息,如主机名、端口号等return discoveryClient.getInstances(serviceName);}}

6.启动本地的服务端:
在这里插入图片描述
7.启动服务注册和发现:在主应用类中,通过@EnableDiscoveryClient注解启用服务注册和发现
在这里插入图片描述

8.访问:localhost:8101/product
在这里插入图片描述
完整项目代码

http://www.fp688.cn/news/160743.html

相关文章:

  • 太原市给企业做网站海外推广
  • 门户网站开发合同网页制作软件
  • 在县城做哪个招聘网站比较赚钱今日油价最新
  • 怎么做自适应的网站百度站长平台链接提交
  • 网站页面设计客服富阳seo关键词优化
  • 山西省建设厅官网站百度快速查询
  • 重庆住房和城乡建设部网站的打印准考证宁波优化系统
  • 如何由网页生成网站平台推广是什么
  • 日ip5000的网站怎么做站长推广网
  • 福建有没有网站做一件代发网站推广软件有哪些
  • 如何将自己做网站放上网下列哪些店铺适合交换友情链接
  • 北京做网站比较有名的公司有哪些企业培训体系搭建
  • 网站建设一般好久到期怎样在百度上做广告推广
  • 网站搭建后台宁波关键词优化企业网站建设
  • 做网站点击软件百度关键词优化点击 教程
  • 赣州建网站做网站怎么赚钱
  • No酒类网站建设seo培训价格
  • 企业网站建设联系电话网络推广宣传方式
  • 工程建设造价全过程监督网站快速优化网站排名软件
  • 台州网站建设方案优化河北百度推广客服电话
  • 嘉定区整站seo十大排名热搜榜排名今日事件
  • asp做网站的步骤中国最好的营销策划公司
  • 在家做的客服正规平台靠谱seo外包定制
  • 婚纱摄影网站开题报告网站推广的主要方法
  • 网站cms相关知识完整的网页设计代码
  • 自己怎么做微信小程序免费武汉seo服务外包
  • 网站建设衤金手指花总天津seo建站
  • 有合作做时时彩网站的吗想卖产品怎么推广宣传
  • 南京建站公司网站企业培训的目的和意义
  • 怎么样增加网站权重hyein seo