SpringCloud注册中心编写和测试

(1)创建注册中心工程

(2)添加jar包  pom.xml

<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>com.jh</groupId>

<artifactId>TestSpringCloud</artifactId>

<version>0.0.1-SNAPSHOT</version>

<packaging>jar</packaging>

<name>TestSpringCloud</name>

<url>http://maven.apache.org</url>

<properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

</properties>

<!--  1 spring boot parent  -->

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>1.4.3.RELEASE</version>

<relativePath/>

</parent>

<!-- spring    -->

<dependencies>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter</artifactId>

</dependency>

<!--2 注册服务中心   -->

<dependency>

<groupId>org.springframework.cloud</groupId>

<artifactId>spring-cloud-starter-eureka-server</artifactId>

</dependency>

<!-- spring  boot 测试 -->

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-test</artifactId>

<scope>test</scope>

</dependency>

<!-- spring cloud  版本 -->

</dependencies>

<dependencyManagement>

<dependencies>

<dependency>

<groupId>org.springframework.cloud</groupId>

<artifactId>spring-cloud-dependencies</artifactId>

<version>Dalston.SR3</version>

<type>pom</type>

<scope>import</scope>

</dependency>

</dependencies>

</dependencyManagement>

</project>

(3) 编写主程序

@EnableEurekaServer // 开启注册服务

@SpringBootApplication // spring boot应用程序

public class EurekaServer {

public static void main(String[] args) {

SpringApplication.run(EurekaServer.class, args);

}

}

(4)配置文件application.properties

server.port=8001

eureka.instance.hostname=localhost

eureka.client.register-with-eureka=false

eureka.client.fetch-registry=false

eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/

(5)测试:

打开浏览器输入http://loclalhost:8001

系统返回

转载于:https://blog.51cto.com/14048134/2310471

springCloud分布式事务实战(三)分布式事务处理器的编译和运行之注册中心编写与测试...相关推荐

  1. 微服务分布式事务实战(一) 项目需求描述和实现步骤

    本文通过一个具体实例如何实施springCloud 分布式事务,不对分布式事务理论做探索.由于内容较多,分多个小节来说明 案例需求: 创建2个基于springCloud的微服务,分别访问不同的数据库: ...

  2. RedisSon高并发分布式锁实战RedisSon源码解读

    Redis高并发分布式锁实战 1.分布式场景下的synchronized失效的问题–用redis实现分布式锁 synchronized是通过monitor实现的jvm级别的锁,如果是分布式系统,跑在不 ...

  3. Mybatis事务(一)事务管理方式

    一.Mybatis事务(二)事务隔离级别 二.Mybatis事务(三)事务工厂 Mybatis管理事务是分为两种方式: (1)使用JDBC的事务管理机制,就是利用java.sql.Connection ...

  4. Java生鲜电商平台-SpringCloud微服务架构中分布式事务解决方案

    Java生鲜电商平台-SpringCloud微服务架构中分布式事务解决方案 说明:Java生鲜电商平台中由于采用了微服务架构进行业务的处理,买家,卖家,配送,销售,供应商等进行服务化,但是不可避免存在 ...

  5. 分布式事务(三):分布式事务解决方案之TCC(Try、Confirm、Cancel)

    什么是TCC TCC是Try.Contirm.Cancel三个词语的缩写,TCC要求每个 分支事务实现三个操作:预处理Try.确认Contirm.撤销Cancel.Try操作业务检查以及资源预留,Co ...

  6. 分布式事务讲解 - TX-LCN分布式事务框架(含LCN、TCC、TXC三种模式)

    分布式事务讲解 - TX-LCN分布式事务框架(含LCN.TCC.TXC三种模式) 分布式事务系列博客: TX-LCN框架原理 LCN 原理及主要特点 代码实现 实现场景 创建数据库及表(三个数据库, ...

  7. springcloud分布式事务解决方案_搞懂分布式技术18:分布式事务常用解决方案

    本文转载自 http://linkedkeeper.com 本文内容参考网络,侵删 本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 http ...

  8. 电商项目实战之分布式事务解决方案

    电商项目实战之分布式事务解决方案 本地事务 事务隔离级别 事务传播机制 分布式事务 CAP理论 选举与同步理论 BASE理论 解决方案 2PC模式(XA事务) 柔性事务-TCC事务补偿型方案 柔性事务 ...

  9. 基于RabbitMQ消息队列的分布式事务解决方案 - MQ分布式消息中间件实战

    基于RabbitMQ消息队列的分布式事务解决方案 - MQ分布式消息中间件实战 参考文章: (1)基于RabbitMQ消息队列的分布式事务解决方案 - MQ分布式消息中间件实战 (2)https:// ...

最新文章

  1. python执行linux命令返回结果_Python中调用Linux命令并获取返回值
  2. 转载 .net面试题大全(有答案)
  3. mysql5.5在windows7下编译的详细步骤_Windows7下编译MySQL5.5的详细步骤
  4. 关于开源堡垒机Jumpserver二次开发
  5. excel的快捷键ctrl+;无效
  6. stm32 usmart使用
  7. gdb ldexp_带有Python示例的math.ldexp()方法
  8. 【白皮书分享】工业互联网平台新模式新业态白皮书.pdf
  9. centos6配置mysql远程访问_mysql设置密码远程访问编码格式
  10. linux方向键ascii_Linux
  11. android studio查看应用文件,AndroidStudio里面使用openFileOutput新建的文件如何查看
  12. 通过ROS控制真实机械臂(17) --- 视觉抓取之ORK实现三维物体识别
  13. 4.4 输入法图片 android,支持安卓4.4!搜狗输入法5.1新版发布
  14. 微信公众号选择什么服务器好,微信开发选择订阅号还是服务号好?
  15. 社会单位消防安全户籍化管理系统——半自动提交V1.0版本
  16. GNSS差分码偏差(DCB)文件下载
  17. Springboot之初入江湖
  18. mysql集群 MySQL Cluster
  19. linux xz命令
  20. 算法设计与分析课程复习笔记11——单源最短路径

热门文章

  1. ubuntu20.04安装mysql教程
  2. C++文件操作之get/getline(待学)
  3. 在Ubuntu18.04系统下彻底删除MySQL的方法
  4. android模糊检索_【android学习笔记】ormlite学习之模糊搜索like
  5. 概率论-2.1 随机变量及其分布(重点:右连续的来源)
  6. 15.3 动态类型安全
  7. 对于Array的引用
  8. 使用javaMail收邮件 支持附件下载
  9. Liferay Portal额外研究-银狐999
  10. 2018.12.08 codeforces 939E. Maximize!(二分答案)