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

2_网站建设的一般步骤包含哪些?网站建设时间怎么查询

2_网站建设的一般步骤包含哪些?,网站建设时间怎么查询,软件工程文档,seo优化方案模板下面写一个简单的demo验证下eureka#xff0c;实现服务注册、服务发现。 一、单节点#xff1a; 1、api#xff1a; 封装其他组件需要共用的dto 2、eureka-service服务注册中心#xff1a; #xff08;1#xff09;pom: ?xml version1.0 encoding实现服务注册、服务发现。 一、单节点 1、api 封装其他组件需要共用的dto 2、eureka-service服务注册中心 1pom: ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.demo.cloud/groupIdartifactIdmyspringcloud-eureka-server/artifactIdversion1.0-SNAPSHOT/version!-- springBoot --parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion1.5.9.RELEASE/version/parentpropertiesproject.build.sourceEncodingUTF-8/project.build.sourceEncodingproject.reporting.outputEncodingUTF-8/project.reporting.outputEncodingjava.version1.8/java.versionspring-cloud.versionEdgware.RELEASE/spring-cloud.version/propertiesdependencies!--eureka-server--dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-eureka-server/artifactId/dependency/dependenciesdependencyManagementdependenciesdependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-dependencies/artifactIdversion${spring-cloud.version}/versiontypepom/typescopeimport/scope/dependency/dependencies/dependencyManagementrepositoriesrepositoryidspring-milestones/idnameSpring Milestones/nameurlhttps://repo.spring.io/libs-milestone/urlsnapshotsenabledfalse/enabled/snapshots/repository/repositories/project 2application.properties:在默认设置下该服务注册中心也会将自己作为客户端来尝试注册它自己所以需要禁用它的客户端注册行为 server.port1111 eureka.client.registerWithEurekafalse eureka.client.fetchRegistryfalse eureka.client.serviceUrl.defaultZonehttp://localhost:1111/eureka/ 3启动类 package com.demo.cloud;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;SpringBootApplication EnableEurekaServer public class MyEurekaServerApplication {public static void main(String args[]){SpringApplication.run(MyEurekaServerApplication.class,args);} }启动后访问http://localhost:1111/ 就可以从后台监控服务了是不是比dubbo搭建zk注册中心方便多了 此时还没有服务注册过来可以看到application下是空的。 3、eureka-client注册服务提供者将原有的springboot工程改造注册到eureka注册中心 1pom: ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.demo.cloud/groupIdartifactIdmyspringcloud-eureka-client/artifactIdversion1.0-SNAPSHOT/version!-- springBoot --parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion1.5.9.RELEASE/version/parentpropertiesproject.build.sourceEncodingUTF-8/project.build.sourceEncodingproject.reporting.outputEncodingUTF-8/project.reporting.outputEncodingjava.version1.8/java.versionspring-cloud.versionEdgware.RELEASE/spring-cloud.version/propertiesdependencies!--eureka-server--dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-eureka-server/artifactId/dependencydependencygroupIdcom.demo.cloud.api/groupIdartifactIdmyspringcloud-api/artifactIdversion1.0-SNAPSHOT/version/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependency!-- mybatis --dependencygroupIdorg.mybatis.spring.boot/groupIdartifactIdmybatis-spring-boot-starter/artifactIdversion1.1.1/version/dependencydependencygroupIdmysql/groupIdartifactIdmysql-connector-java/artifactIdversion5.1.21/version/dependencydependencygroupIdcommons-collections/groupIdartifactIdcommons-collections/artifactIdversion3.2.1/version/dependencydependencygroupIdcommons-lang/groupIdartifactIdcommons-lang/artifactIdversion2.5/version/dependency/dependenciesdependencyManagementdependenciesdependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-dependencies/artifactIdversion${spring-cloud.version}/versiontypepom/typescopeimport/scope/dependency/dependencies/dependencyManagementrepositoriesrepositoryidspring-milestones/idnameSpring Milestones/nameurlhttps://repo.spring.io/libs-milestone/urlsnapshotsenabledfalse/enabled/snapshots/repository/repositories/project 2application.properties: server.port2222 server.context-path/myService spring.application.namemy-service eureka.client.serviceUrl.defaultZonehttp://localhost:1111/eureka/#mybatis spring.datasource.driver-class-namecom.mysql.jdbc.Driver spring.datasource.urljdbc:mysql://localhost:3306/demo?useUnicodetruecharacterEncodingutf-8useSSLfalse spring.datasource.usernameroot spring.datasource.passwordwtyy mybatis.mapper-locationsclasspath*:Mapper/*Mapper.xml3dao、service、Mappermybatis持久化部分此处省略 4controller package com.demo.cloud.controller;import com.demo.cloud.dto.AuthorityDTO; import com.demo.cloud.dto.UserDTO; import com.demo.cloud.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;import java.util.List;RequestMapping(/user) RestController public class UserApiController {Autowiredprivate UserService userService;Value(${server.port})private String port;RequestMapping(/findByUserName)public UserDTO findByUserName(String username){return userService.findByUserName(username);}RequestMapping(/getAllUsers)public ListUserDTO getAllUsers(){System.out.println(port);return userService.getAllUsers();}RequestMapping(/getAuthortiesByUserId)public ListAuthorityDTO getAuthortiesByUserId(Integer userId){return userService.getAuthortiesByUserId(userId);}RequestMapping(/addUser)public void addUser1(RequestBody UserDTO userDTO){userService.addUser(userDTO);}}5启动类 package com.demo.cloud; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;SpringBootApplication EnableEurekaClient MapperScan(com.demo.cloud.dao) public class MyEurekaClientApplication {public static void main(String args[]){SpringApplication.run(MyEurekaClientApplication.class,args);} }注意这里使用的是EnableEurekaClient注解也可以使用EnableDiscoveryClient注解  EnableEurekaClient是Eureka特有的注解用于启动Eureka客户端。当使用Eureka作为注册中心时就推荐使用EnableEurekaClient注解应用启动后会自动注册到Eureka Server并完成服务治理。 EnableDiscoveryClient是Spring Cloud通用的注解可以与Eureka、Consul等多种注册中心对接。当我们的微服务同时需要与多个注册中心集成时就需要使用EnableDiscoveryClient注解。 可以说EnableEurekaClient是EnableDiscoveryClient的一个具体实现如果项目中注册中心只使用Eureka那么使用EnableEurekaClient更加方便和简单。但如果要切换到其他的注册中心改动较大。启动项目再浏览下http://localhost:1111/ 可以看到注册成功了。 二、高可用部署 1、先部署eukera-service的高可用 2、再部署eureka-client的高可用连接注册中心的配置项改为多个,以逗号分隔然后将该组件部署多个节点即可 eureka.client.serviceUrl.defaultZonehttp://localhost:1111/eureka/,http://xxx.xx.xxx:1111/eureka/
http://www.tj-hxxt.cn/news/139768.html

相关文章:

  • 米方科技网站建设交易网站建设需要学什么
  • 网站源码中国有限公司php语言 网站建设
  • 网站认证值不值得做工作细胞第二季
  • 网站做子站点有什么用海口智能建站价格
  • 在国外做h网站怎么样他们怎么做的刷赞网站
  • 互联网公司 网站网站没被百度收录
  • 利用帝国软件如何做网站wordpress 密码提示
  • 网站续费查询建设网站项目简历
  • 个人怎么做电影相关的网站网站建设的一般流程是怎样的
  • 摄影工作室网站模板vip解析网站怎么做
  • 网站开发用什么字体网页站点是什么意思
  • 做一级域名网站多少钱外贸网络推广专员
  • h5网站开发企业标准化体系建设流程
  • 东台建设网站wordpress 后台忘了
  • 网站建设与管理教学视频西安网站品牌建设
  • 网站被人做跳转恺英网络公司最新消息
  • 网页制作与网站建设宝典扫描版pdf百万网站建设报价
  • 常州微信网站建设咨询东莞网站建站推广
  • 长沙免费建站模板专业柳州网站建设哪家便宜
  • 干净简约的网站怎么做网站支付
  • 电子商务网站建设特点网上商城网站建设报价
  • ps网站导航条素材seo怎么做网站优秀案例
  • 做自媒体都有什么网站下载黑龙江建设网官网网站
  • 国内免费推广网站如何做网站改版
  • wordpress阿里云云存储绵阳做网站优化
  • 盘锦做网站选哪家已有备案号新增网站备案要关闭原先的站点吗
  • 烟台网站排名优化一级造价工程师报名时间
  • 漳浦县城乡规划建设局官方网站松原市建设局网站投诉中心
  • 电子商务网站与建设课件开发一个app需要什么条件
  • 网站内容编写方法企业为什么做网站素材