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

杭州市建设工程检测协会网站新网站建设一般多少钱

杭州市建设工程检测协会网站,新网站建设一般多少钱,wordpress服务器不支持中文tag,做网站赚钱容易吗目录 环境搭建 Dubbo的3种使用方式#xff1a; 1. XML配置的方式#xff0c;一般用于Spring MVC工程 2. 配置文件的方式 #xff08;spring boot工程#xff09; 3. 注解方式 Dubbo 控制台 环境搭建 本篇将介绍Spring boot zookeeper Dubbo 简易环境的搭建以及使用…目录 环境搭建 Dubbo的3种使用方式 1. XML配置的方式一般用于Spring MVC工程 2. 配置文件的方式 spring boot工程 3. 注解方式 Dubbo 控制台 环境搭建 本篇将介绍Spring boot zookeeper Dubbo 简易环境的搭建以及使用首先准备好一台虚拟机。 1. 在虚拟机上安装JDK8及以上版本可以参考我的另一篇博客 https://www.cnblogs.com/chen1-kerr/p/6907280.html 2. 在虚拟机上安装zookeeper。可以是单机也可以是集群。可以参考我的文件 单机 zookeeper 单机环境搭建三_chen_yao_kerr的博客-CSDN博客  集群 zookeeper集群二_zookeeper集群相互发现_chen_yao_kerr的博客-CSDN博客  3. 新建2个spring boot工程一个是Server端一个是client端并且引入zookeeper 和 dubbo依赖的jar包。 ?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 http://maven.apache.org/xsd/maven-4.0.0.xsdparentartifactIddubbo-basic/artifactIdgroupIdcom.enjoy/groupIdversion1.0/version/parentmodelVersion4.0.0/modelVersionartifactIdbusi-xml-server-client/artifactIddependenciesdependencygroupIdcom.enjoy/groupIdartifactIdbusi-api/artifactIdversion1.0/version/dependency!-- spring支持 --dependencygroupIdorg.springframework/groupIdartifactIdspring-core/artifactIdversion${spring.version}/version/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-context/artifactIdversion${spring.version}/version/dependency!-- dubbo --dependencygroupIdcom.alibaba/groupIdartifactIddubbo-config-spring/artifactIdversion${dubbo.version}/version/dependency!-- zookeeper注册中心 --dependencygroupIdcom.alibaba/groupIdartifactIddubbo-registry-zookeeper/artifactIdversion${dubbo.version}/version/dependencydependencygroupIdcom.alibaba/groupIdartifactIddubbo-rpc-dubbo/artifactIdversion${dubbo.version}/version/dependencydependencygroupIdcom.alibaba/groupIdartifactIddubbo-remoting-netty/artifactIdversion${dubbo.version}/version/dependencydependencygroupIdcom.alibaba/groupIdartifactIddubbo-serialization-hessian2/artifactIdversion${dubbo.version}/version/dependencydependencygroupIdjunit/groupIdartifactIdjunit/artifactIdversion${junit_version}/version/dependency/dependencies /project我本次使用的虚拟机IP是 192.168.0.105。 因此需要到这台虚拟机服务器上启动zookeeper 抽象出接口 Dubbo的3种使用方式 1. XML配置的方式一般用于Spring MVC工程 服务端Server 服务端需要去实现这个接口因为这个实现类要提供具体的业务处理逻辑 服务端的xml配置 ?xml version1.0 encodingUTF-8?beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:contexthttp://www.springframework.org/schema/contextxmlns:dubbohttp://code.alibabatech.com/schema/dubboxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.1.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsd!--全局配置--dubbo:provider timeout3000 /!-- 服务提供方应用名称, 方便用于依赖跟踪 --dubbo:application namebusi-server/!-- 使用本地zookeeper作为注册中心 --dubbo:registry addresszookeeper://192.168.0.105:2181 /!--name指示使用什么协议监听端口dubbo/rmi/rest--dubbo:protocol idd1 namedubbo port20880 /dubbo:protocol idd2 namedubbo port20882 /!-- 通过xml方式配置为bean, 让spring托管和实例化 --bean idorderService classcom.enjoy.service.OrderServiceImpl/!-- 声明服务暴露的接口并暴露服务 --dubbo:service interfacecom.enjoy.service.OrderService reforderService protocold1 / /beans 、客户端Consumer ?xml version1.0 encodingUTF-8?beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:contexthttp://www.springframework.org/schema/contextxmlns:dubbohttp://code.alibabatech.com/schema/dubboxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.1.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsddubbo:application namebusi-client /dubbo:registry addresszookeeper://192.168.0.105:2181 /dubbo:consumer /dubbo:reference idorderService interfacecom.enjoy.service.OrderService //beans 启动Server 启动客户端 2. 配置文件的方式 spring boot工程 首先在Server端定义配置文件 开放一个业务类 服务端加载配置 在Consumer端定义配置文件 定义一个类这个类要从远程服务器上拿到需要使用的实例 消费端调用 3. 注解方式 这种方式其实和第2种方式基本一致唯一的不同就是少了个配置文件这个配置文件多了些注入的类 服务端代码 /*** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. See the NOTICE file distributed with* this work for additional information regarding copyright ownership.* The ASF licenses this file to You under the Apache License, Version 2.0* (the License); you may not use this file except in compliance with* the License. You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.**/package com.enjoy.dubbo.annotation;import com.alibaba.dubbo.config.ApplicationConfig; import com.alibaba.dubbo.config.ProtocolConfig; import com.alibaba.dubbo.config.ProviderConfig; import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;public class Provider {public static void main(String[] args) throws Exception {AnnotationConfigApplicationContext context new AnnotationConfigApplicationContext(ProviderConfiguration.class);context.start();System.out.println(---------dubbo启动成功--------);System.in.read();}ConfigurationEnableDubbo(scanBasePackages com.enjoy.service)static class ProviderConfiguration {Beanpublic ProviderConfig providerConfig() {ProviderConfig providerConfig new ProviderConfig();providerConfig.setTimeout(1000);return providerConfig;}Beanpublic ApplicationConfig applicationConfig() {ApplicationConfig applicationConfig new ApplicationConfig();applicationConfig.setName(busi-provider);return applicationConfig;}Beanpublic RegistryConfig registryConfig() {RegistryConfig registryConfig new RegistryConfig();registryConfig.setProtocol(zookeeper);registryConfig.setAddress(192.168.0.105);registryConfig.setPort(2181);return registryConfig;}Beanpublic ProtocolConfig protocolConfig() {ProtocolConfig protocolConfig new ProtocolConfig();protocolConfig.setName(dubbo);protocolConfig.setPort(20880);return protocolConfig;}}}客户端 /*** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. See the NOTICE file distributed with* this work for additional information regarding copyright ownership.* The ASF licenses this file to You under the Apache License, Version 2.0* (the License); you may not use this file except in compliance with* the License. You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.**/package com.enjoy.dubbo.annotation;import com.alibaba.dubbo.config.ApplicationConfig; import com.alibaba.dubbo.config.ConsumerConfig; import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; import com.enjoy.action.ServiceConsumer; import com.enjoy.entity.OrderEntiry; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration;public class Consumer {public static void main(String[] args) {AnnotationConfigApplicationContext context new AnnotationConfigApplicationContext(ConsumerConfiguration.class);context.start();System.out.println(---------dubbo启动成功--------);ServiceConsumer serviceConsumer context.getBean(ServiceConsumer.class);OrderEntiry entiry serviceConsumer.getDetail(1);System.out.println(result: entiry.getMoney());}ConfigurationEnableDubbo(scanBasePackages com.enjoy.action)ComponentScan(value {com.enjoy.action})static class ConsumerConfiguration {Beanpublic ApplicationConfig applicationConfig() {ApplicationConfig applicationConfig new ApplicationConfig();applicationConfig.setName(busi-consumer);return applicationConfig;}Beanpublic ConsumerConfig consumerConfig() {ConsumerConfig consumerConfig new ConsumerConfig();consumerConfig.setTimeout(3000);return consumerConfig;}Beanpublic RegistryConfig registryConfig() {RegistryConfig registryConfig new RegistryConfig();registryConfig.setProtocol(zookeeper);registryConfig.setAddress(192.168.0.105);registryConfig.setPort(2181);return registryConfig;}} }其实具体怎么用可根据实际情况进行选择。如果是Spring MVC工程选第一种方式比较好。如果是Spring boot工程我个人倾向于选择第二种方式也就是注解配置文件的方式。 Dubbo 控制台 dubbo-admin 的地址为 mirrors / apache / dubbo-admin · GitCode  但是我使用命令拉下来总是少文件所有我直接下载的zip包解压。 修改配置 编译并启动 能打开页面能够登录即可 上方介绍了集中服务端启动的方式选择任意一种方式启动服务端代码如果在控制台能够发现即可
http://www.hkea.cn/news/14534206/

相关文章:

  • 杭州哪个网站建设最好左右左右网站
  • 做企业网站需要买什么宣传页模板
  • wordpress全站关闭评论东莞做网站一年费用
  • 保定网站优化哪家好搜索引擎优化的七个步骤
  • 网站开发常用插件有没有做3d衣服模型网站
  • 济南网络免费推广网站wordpress 加载页面
  • 定制网站开发一般多少钱scc全球电商分发平台
  • 深圳最好的网站建设公司哪家好wordpress中文竖排
  • 建网站需要编程吗怎么推广游戏叫别人玩
  • 北京设计网站的公司百度统计数据
  • 用ps做网站方法绍兴市交通建设有限公司网站
  • 人工智能营销网站开发黑客钓鱼网站的制作
  • joomla网站模板深圳高端网站建设怎么样
  • c2c电子商务网站需具备哪些业务功能重庆为什么导航用不了
  • kesion系统做网站教程常用网站设计缩略图
  • 只有域名如何做网站怎样做类似淘宝网的网站
  • 建站宝盒源码wordpress5.0中文编辑器
  • 视频网站开发公司推广策划案怎么写
  • 网站设计网站制作建站之星安装模板失败
  • 单页面网站现在共享网站的详细规划
  • 彭阳门户网站建设百度惠生活推广怎么收费
  • 北京建设网站网站安徽省建设工程招投标信息网
  • 公司开发个网站多少钱上海企乐网站制作公司
  • 网站用excel做数据库培训网站方案
  • 仿站参考网站wordpress获取页面图片
  • 网站怎么做站内美化php7 nginx wordpress
  • 济南中京网站建设公司天猫网站企业网站专业性诊断分析
  • 简述新建站点的步骤网站建设与网站优化
  • 北京网站建设知名公司排名wordpress重置主题
  • 信阳公司网站建设php网站建设视频教程