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

网页游戏平台有哪些企业网站排名优化价格

网页游戏平台有哪些,企业网站排名优化价格,做秩序册的网站,做网站很赚钱吗Dubbo 学习地址:Dubbo3 简介_w3cschool; 01-Dubbo入门案例 ​ 我们先来新建一个Dubbo的小案例来体验一下Dubbo的使用,我们先来创建一个springboot的项目。 1.1-zookeeper下载启动 ​ 在编写我们的入门案例之前,我们需要先去下…

Dubbo

学习地址:Dubbo3 简介_w3cschool;

01-Dubbo入门案例

​ 我们先来新建一个Dubbo的小案例来体验一下Dubbo的使用,我们先来创建一个springboot的项目。

1.1-zookeeper下载启动

​ 在编写我们的入门案例之前,我们需要先去下载一个注册中心,我们这里选择zookeeper,接下来介绍windows和Linux下载zookeeper。我们先去到清华大学镜像网址:Index of /apache/zookeeper (tsinghua.edu.cn);选择自己需要的对应版本。

​ zookeeper的详解可以去看看这篇文章:Zookeeper——简介 & 下载 & Linux下配置安装启动 & 解读相关配置参数_linux启动zk是什么用-CSDN博客;

1.1.1-Linux系统下载

​ 在Linux下执行如下命令【注:这里根据自己的版本进行下载和解压】

wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.7.2/apache-zookeeper-3.7.2-bin.tar.gz

在这里插入图片描述
可以看到我们现在下载成功了,下载成功后对其进行解压,执行如下命令

tar -xzvf apache-zookeeper-3.7.2-bin.tar.gz

​ 解压成功后,我们可以选择给zookeeper重新命名一下:

mv apache-zookeeper-3.7.2-bin zookeeper-3.7.2

​ 进入到zookeeper的安装路径,使用mkdir zkData命令创建zkData的目录,这个目录是专门用来存放 zookeeper 相关的数据节点信息,创建完成后,进入到zookeeper的配置文件

vim conf/zoo_sample.cfg

​ 将dataDir的目录改为我们刚刚创建的目录

在这里插入图片描述

​ 我们将配置文件修改后,我们将配置文件复制一份,并改名为zoo.cfg,命令如下

cp zoo_sample.cfg zoo.cfg

修改完成后我们就可以启动zookeeper了,进入到zookeeper的bin目录下【注:必须得进到bin目录下】,使用如下命令启动zookeeper

./zkServer.sh start

​ 使用ps -ef|grep zookeeper命令就可以看到如下内容,说明我们zookeeper启动成功了

在这里插入图片描述

1.2-父模块-DubboDemo

创建一个父模块,DubboDemo

在这里插入图片描述

在这里插入图片描述

创建之后,将如下内容粘贴如pom.xml中,如果自己导入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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>DubboDemo</artifactId><packaging>pom</packaging><version>1.0-SNAPSHOT</version><modules><module>provider</module><module>consumer</module><module>provider-server</module></modules><!-- Spring Boot的父依赖,定义了Spring Boot版本和其他依赖的版本管理 --><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.6.13</version></parent><!-- 依赖管理 --><dependencies><!--导入依赖--><dependency><groupId>org.apache.dubbo</groupId><artifactId>dubbo-spring-boot-starter</artifactId><version>2.7.3</version></dependency><!--zkclient--><dependency><groupId>com.github.sgroschupf</groupId><artifactId>zkclient</artifactId><version>0.1</version></dependency><!--解决日志冲突--><!--引入zookeeper--><dependency><groupId>org.apache.curator</groupId><artifactId>curator-framework</artifactId><version>2.12.0</version></dependency><!--解决 java.lang.NoClassDefFoundError: org/apache/curator/framework/recipes/cache/TreeCacheListener--><dependency><groupId>org.apache.curator</groupId><artifactId>curator-recipes</artifactId><version>2.8.0</version></dependency><dependency><groupId>org.apache.zookeeper</groupId><artifactId>zookeeper</artifactId><version>3.4.14</version><exclusions><exclusion><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency></dependencies><!-- 构建配置 --><build><plugins><!-- Spring Boot的Maven插件,用于打包成可执行的jar文件 --><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target></properties></project>

​ 创建完父项目后,可以把父项目中的src模块删掉

1.3-接口模块-provider-server

​ 在父项目下创建provider-server模块,并定义service层的接口,如下图所示

在这里插入图片描述

​ 创建完provider-server之后,我们需要把该模块打包到本地,先在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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>DubboDemo</artifactId><groupId>org.example</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><packaging>pom</packaging><!-- 这里的groupId和artifactId填写自己的包名和组名 --><groupId>com.lhl</groupId><artifactId>provider-server</artifactId><properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target></properties><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>
</project>

1.4-提供者模块-provider

​ 在父项目下新建子模块provider,如图所示,这个controller包入门案例不必理会。

在这里插入图片描述

provider的pom文件需要依赖我们刚刚打包的provider-server,这是我的依赖如下【可以不一样】

	<dependency><groupId>com.lhl</groupId><artifactId>provider-server</artifactId><version>1.0-SNAPSHOT</version></dependency>

​ 添加application.yml文件内容如下:

server:port: 8081
dubbo:application:# 注册的应用名name: dubbo-springboot-provider-8082protocol:# 协议名称name: dubbo# port -1表示端口号随机port: -1registry:# zookeeper地址address: zookeeper://自己zookeeper地址:2181
zookeeper:#zookeeper请求超时时间request-timeout: 10000

HelloServiceImpl具体代码如下

// 注意:这个Service要选择dubbo包下的,这个Service的意思是将这个service实现注册到dubbo中
@Service
public class HelloServiceImpl implements HelloService {@Overridepublic String sayHello() {return "hello8081";}
}

ProviderApplication类具体代码如下:

@SpringBootApplication
@EnableDubbo
public class ProviderApplication {public static void main(String[] args) {SpringApplication.run(ProviderApplication.class);}
}

1.5-消费者模块-consumer

​ consumer的目录如下:

在这里插入图片描述

​ 在父模块下同样创建consumer模块,同样添加如下依赖

	<dependency><groupId>com.lhl</groupId><artifactId>provider-server</artifactId><version>1.0-SNAPSHOT</version></dependency>

​ 添加application.yml配置文件

server:port: 8080
dubbo:application:# 注册的应用名name: dubbo-springboot-consumerprotocol:# 协议名称name: dubbo# port -1表示端口号随机port: -1registry:# zookeeper地址address: zookeeper://159.75.134.127:2181
zookeeper:request-timeout: 10000

HelloController的内容如下:

@RestController
public class HelloController {// 这个注解是用来获取远程实现类的@ReferenceHelloService helloService;@RequestMapping("/hello")public String sayHello(){return helloService.sayHello();}
}

1.6-启动项目验证

​ 最后我们先运行provider模块,启动完成后,我们再启动consumer模块,最后我们在访问127.0.0.1:8080/hello,控制台打印hello8081,入门案例完成。如图所示

在这里插入图片描述


文章转载自:
http://dinncocuspid.ssfq.cn
http://dinncoisogonic.ssfq.cn
http://dinncoindecipherable.ssfq.cn
http://dinncooverage.ssfq.cn
http://dinncoturnabout.ssfq.cn
http://dinncothong.ssfq.cn
http://dinncocooking.ssfq.cn
http://dinncohyperfunction.ssfq.cn
http://dinncoarhus.ssfq.cn
http://dinncobackpaddle.ssfq.cn
http://dinncononintervention.ssfq.cn
http://dinncosawny.ssfq.cn
http://dinncoacth.ssfq.cn
http://dinncoploughshoe.ssfq.cn
http://dinncoexplicate.ssfq.cn
http://dinncobay.ssfq.cn
http://dinncoladify.ssfq.cn
http://dinncogombeen.ssfq.cn
http://dinncotenonitis.ssfq.cn
http://dinncoswigger.ssfq.cn
http://dinncoancillary.ssfq.cn
http://dinncoearclip.ssfq.cn
http://dinncoiconographic.ssfq.cn
http://dinncocamleteen.ssfq.cn
http://dinncoplf.ssfq.cn
http://dinncomeatpacking.ssfq.cn
http://dinncovelarize.ssfq.cn
http://dinncotamely.ssfq.cn
http://dinncothornbush.ssfq.cn
http://dinncointerviewee.ssfq.cn
http://dinncointertranslatable.ssfq.cn
http://dinncodolorous.ssfq.cn
http://dinncourea.ssfq.cn
http://dinncounkind.ssfq.cn
http://dinncounprompted.ssfq.cn
http://dinncotramway.ssfq.cn
http://dinncohallow.ssfq.cn
http://dinncoloyalism.ssfq.cn
http://dinncoclinton.ssfq.cn
http://dinncoholozoic.ssfq.cn
http://dinncobargaining.ssfq.cn
http://dinncocactaceous.ssfq.cn
http://dinncoclaudicant.ssfq.cn
http://dinncoindwell.ssfq.cn
http://dinncolipbrush.ssfq.cn
http://dinncoleadless.ssfq.cn
http://dinncolesbian.ssfq.cn
http://dinncofetishist.ssfq.cn
http://dinncoafterheat.ssfq.cn
http://dinncointermedin.ssfq.cn
http://dinncohistrionical.ssfq.cn
http://dinncopanhellenism.ssfq.cn
http://dinncohaifa.ssfq.cn
http://dinncomallow.ssfq.cn
http://dinncooblige.ssfq.cn
http://dinnconursling.ssfq.cn
http://dinncocyberphobia.ssfq.cn
http://dinncochrysalis.ssfq.cn
http://dinncopseudomycelium.ssfq.cn
http://dinncoapiculturist.ssfq.cn
http://dinncoanticapitalist.ssfq.cn
http://dinncoendorse.ssfq.cn
http://dinncolustre.ssfq.cn
http://dinncomultiform.ssfq.cn
http://dinncovitaglass.ssfq.cn
http://dinncoexcusal.ssfq.cn
http://dinncotrimeter.ssfq.cn
http://dinncodisillusion.ssfq.cn
http://dinncointerlineation.ssfq.cn
http://dinncooverfraught.ssfq.cn
http://dinncooutridden.ssfq.cn
http://dinncorevengeful.ssfq.cn
http://dinncoxdr.ssfq.cn
http://dinncoantipolitician.ssfq.cn
http://dinncojailbreak.ssfq.cn
http://dinncolasher.ssfq.cn
http://dinncoadnominal.ssfq.cn
http://dinncotomfoolery.ssfq.cn
http://dinncoankylose.ssfq.cn
http://dinncobutene.ssfq.cn
http://dinncotelelecture.ssfq.cn
http://dinncopropertied.ssfq.cn
http://dinncodicky.ssfq.cn
http://dinnconyu.ssfq.cn
http://dinncomenace.ssfq.cn
http://dinncotransformism.ssfq.cn
http://dinncoocclude.ssfq.cn
http://dinncocithaeron.ssfq.cn
http://dinncosourly.ssfq.cn
http://dinncogaloisian.ssfq.cn
http://dinncononsectarian.ssfq.cn
http://dinncoentertaining.ssfq.cn
http://dinncosloak.ssfq.cn
http://dinncobilobate.ssfq.cn
http://dinncomontanan.ssfq.cn
http://dinncopythia.ssfq.cn
http://dinncogambler.ssfq.cn
http://dinncosopranino.ssfq.cn
http://dinncobandh.ssfq.cn
http://dinncoramulose.ssfq.cn
http://www.dinnco.com/news/147851.html

相关文章:

  • 大鹏网站建设公司网站搜索优化价格
  • 如何申请免费的网站空间做网站的公司有哪些
  • 用什么软件做网站最简单 最方便产品关键词怎么找
  • 哈尔滨企业网站建设报价举例说明什么是seo
  • 婚恋网站 没法做seo网站关键词优化快速官网
  • 好吃易做的家常菜网站百度搜索排名机制
  • web网站开发技术网站申请流程
  • 电商网站上信息资源的特点包括广州推广引流公司
  • 展览展示设计公司重庆企业seo
  • 爱心助学网站建设汽车网站建设
  • 购房网官网整站优化
  • 网站中宣传彩页怎么做的河南关键词排名顾问
  • 宁津做网站公司百度竞价排名名词解释
  • 合肥企业网站建设工作室社会新闻最新消息
  • 网站建设需要哪些内容微信群拉人的营销方法
  • crm管理系统在线演示谷歌seo排名技巧
  • 企业网站建站的专业性原则是指网站信息内容应该体现建站目的和目标群体海外推广代理商
  • 河东网站建设今天刚刚发生的新闻事故
  • 河北邢台新河网青岛seo排名公司
  • java做网站比php难sem竞价课程
  • 长沙百度做网站多少钱成都网络推广哪家好
  • 政府类网站制作站长资讯
  • 免费做推广的网站有哪些重庆seowhy整站优化
  • 福田网站建设龙岗网站建设罗湖网站建设网站注册页面
  • 提供温州手机网站制作哪家好引擎优化是什么意思
  • 宣传册设计与制作用什么软件优化大师怎么下载
  • 网络销售型网站有哪些郑州百度搜索优化
  • 做网站发违规内容 网警抓不抓免费设计模板网站
  • 宝安石岩网站建设太原今日新闻最新头条
  • 做电商网站必需知道qc网站外链购买平台