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

如何把网站做成app怎么让别人访问自己做的网站

如何把网站做成app,怎么让别人访问自己做的网站,买了虚拟主机怎么做网站,帝国cms建站实例教程4 Dubbo快速入门Dubbo作为一个RPC框架#xff0c;其最核心的功能就是要实现跨网络的远程调用。本小节就是要创建两个应用#xff0c;一个作为服务的提供方#xff0c;一个作为服务的消费方。通过Dubbo来实现服务消费方远程调用服务提供方的方法。4.1 服务提供方开发开发步骤…4 Dubbo快速入门Dubbo作为一个RPC框架其最核心的功能就是要实现跨网络的远程调用。本小节就是要创建两个应用一个作为服务的提供方一个作为服务的消费方。通过Dubbo来实现服务消费方远程调用服务提供方的方法。4.1 服务提供方开发开发步骤(1)创建maven工程(打包方式为war)dubbodemo_provider在pom.xml文件中导入如下坐标warUTF-81.81.85.0.5.RELEASEorg.springframeworkspring-context${spring.version}org.springframeworkspring-beans${spring.version}org.springframeworkspring-webmvc${spring.version}org.springframeworkspring-jdbc${spring.version}org.springframeworkspring-aspects${spring.version}org.springframeworkspring-jms${spring.version}org.springframeworkspring-context-support${spring.version}com.alibabadubbo2.6.0org.apache.zookeeperzookeeper3.4.7com.github.sgroschupfzkclient0.1javassistjavassist3.12.1.GAcom.alibabafastjson1.2.47org.apache.maven.pluginsmaven-compiler-plugin2.3.21.81.8org.apache.tomcat.maventomcat7-maven-plugin8081/(2)配置web.xml文件创建 webapp/WEB-INF/web.xmlxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsdversion3.1contextConfigLocationclasspath:applicationContext*.xmlorg.springframework.web.context.ContextLoaderListener(3)创建服务接口package com.maweiqi.service;/*** HelloService** Author: 马 伟 奇* CreateTime: 2019-07-18* Description:*/public interface HelloService {public String sayHello(String name);}(4)创建服务实现类package com.maweiqi.service.impl;import com.alibaba.dubbo.config.annotation.Service;import com.maweiqi.service.HelloService;/*** HelloServiceImpl** Author: 马 伟 奇* CreateTime: 2019-07-18* Description:*/Servicepublic class HelloServiceImpl implements HelloService {Overridepublic String sayHello(String name) {return hello name;}}注意服务实现类上使用的Service注解是Dubbo提供的用于对外发布服务(5)在src/main/resources下创建applicationContext-service.xmlxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:phttp://www.springframework.org/schema/pxmlns:contexthttp://www.springframework.org/schema/contextxmlns:dubbohttp://code.alibabatech.com/schema/dubboxmlns:mvchttp://www.springframework.org/schema/mvcxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd(6)启动服务启动服务4.2 服务消费方开发开发步骤(1)创建maven工程(打包方式为war)dubbodemo_consumerpom.xml配置和上面服务提供者相同只需要将Tomcat插件的端口号改为8082即可warUTF-81.81.85.0.5.RELEASEorg.springframeworkspring-context${spring.version}org.springframeworkspring-beans${spring.version}org.springframeworkspring-webmvc${spring.version}org.springframeworkspring-jdbc${spring.version}org.springframeworkspring-aspects${spring.version}org.springframeworkspring-jms${spring.version}org.springframeworkspring-context-support${spring.version}com.alibabadubbo2.6.0org.apache.zookeeperzookeeper3.4.7com.github.sgroschupfzkclient0.1javassistjavassist3.12.1.GAcom.alibabafastjson1.2.47org.apache.maven.pluginsmaven-compiler-plugin2.3.21.81.8org.apache.tomcat.maventomcat7-maven-plugin8082/(2)配置web.xml文件xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsdversion3.1springmvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:applicationContext-web.xml1springmvc/(3)将服务提供者工程中的HelloService接口复制到当前工程package com.maweiqi.service;/*** HelloService** Author: 马伟奇* CreateTime: 2019-07-18* Description:*/public interface HelloService {public String sayHello(String name);}(4)编写Controllerpackage com.maweiqi.controller;import com.alibaba.dubbo.config.annotation.Reference;import com.maweiqi.service.HelloService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;/*** HelloController** Author: 马伟奇* CreateTime: 2019-07-19* Description:*/ControllerRequestMapping(/demo)public class HelloController {Referenceprivate HelloService helloService;RequestMapping(/hello)ResponseBodypublic String getName(String name){//远程调用String result helloService.sayHello(name);System.out.println(result);return result;}}注意Controller中注入HelloService使用的是Dubbo提供的Reference注解(5)在src/main/resources下创建applicationContext-web.xmlxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:phttp://www.springframework.org/schema/pxmlns:contexthttp://www.springframework.org/schema/contextxmlns:dubbohttp://code.alibabatech.com/schema/dubboxmlns:mvchttp://www.springframework.org/schema/mvcxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd(6)运行测试运行在浏览器输入http://localhost:8082/demo/hello?nameJack查看浏览器输出结果4.3 代码重构① 创建项目dubbodemo_interface创建项目② 把 项目dubbodemo_consumer 和 项目dubbodemo_provider当中的 接口 HelloService 拷贝到dubbodemo_interface工程里面image.png③ 删除工程dubbodemo_consumer 和 工程dubbodemo_provider当中的 接口 HelloServiceimage.pngdubbodemo_consumer 工程和dubbodemo_provider添加pom文件的依赖com.maweiqidubbodemo_interface1.0-SNAPSHOT获取数据5. Dubbo管理控制台我们在开发时需要知道Zookeeper注册中心都注册了哪些服务有哪些消费者来消费这些服务。我们可以通过部署一个管理中心来实现。其实管理中心就是一个web应用部署到tomcat即可。5.1 安装安装步骤(1)将资料中的dubbo-admin-2.6.0.war文件复制到tomcat的webapps目录下image.png(2)启动tomcat此war文件会自动解压image.png(3)修改WEB-INF下的dubbo.properties文件注意dubbo.registry.address对应的值需要对应当前使用的Zookeeper的ip地址和端口号dubbo.registry.addresszookeeper://192.168.134.129:2181dubbo.admin.root.passwordrootdubbo.admin.guest.passwordguestimage.png(4)重启tomcat5.2 使用操作步骤image.png(2)启动服务提供者工程和服务消费者工程可以在查看到对应的信息image.pngimage.png
http://wiki.neutronadmin.com/news/276374/

相关文章:

  • 网站建设专业知识合肥seo网站建设费用
  • 在家做网站维护兼职为什么学习wordpress
  • 做房产网站接不到电话做外贸必看的网站和论坛有哪些
  • 建设银行 英文版网站广告设计与制作专业课程
  • 广州网站设计培训班婚嫁网站建设计划
  • 建立企业网站多少钱网络架构师证书
  • 最专业网站建设开发咸宁网站制作公司
  • 网站开发流程步骤互联网后端开发
  • 网站 域名 空间 服务器线上网络推广方案
  • python建设网站实例wordpress中文cms
  • 网页创建网站做企业平台的网站
  • 网站开发是用模版还是纯手打Hizz wordpress
  • 济南百度公司做网站吗网站前端和后台
  • 台州外贸网站建设站长收录平台
  • 网站改版建议策划书网站网站建设企业
  • 深圳坂田做网站网站建设是编程吗
  • 领卷网站如何做代理河南省建设人才信息网官网
  • 南阳做网站优化公司大连零基础网站建设教学公司
  • 高端网站建设专业免费的软件网站建设
  • 域名网站一个专门做预告片的网站
  • 给小说网站做编辑大朗做网站的
  • 网站设计优化方案做网站运营有前景吗
  • 国外最炫酷网站重庆秀山网站建设报价
  • 出口外贸营销网站网页设计与网站建设 作业
  • 怎么做电脑端网站设计稿word模板网
  • 做h5比较好的网站WordPress 延时加载
  • 自建站电商外贸网站访问跳出率
  • 驻马店市旅游网站建设网站手机版制作
  • 赤峰市做网站公司去除wordpress.org
  • 保定市建设施工许可证查询网站wordpress 4.7.5 漏洞