1 创建一个springboot项目  spring-cloud-service-a  注册到eureka服务注册中心中

项目添加依赖

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>

2 启动类添加注解

@EnableDiscoveryClient

@SpringBootApplication
@EnableDiscoveryClient
public class SpringCloudServiceAApplication { public static void main(String[] args) {
SpringApplication.run(SpringCloudServiceAApplication.class, args);
} }

3 配置文件添加

#指定服务名称

spring.application.name=service-a

#注册服务
eureka.client.service-url.defaultZone=http://localhost:8080/eureka/

4 编写一个controller

@RestController
public class TestController {
@GetMapping("/getm")
public String getMessage(String message) {
return "hello world:"+message;
}
}

5 启动服务,eureka注册中心会有这个服务

spring cloud (二) 服务提供者 EuekaClient的更多相关文章

  1. Spring cloud实战——服务提供者

    目录讲解: 一.服务提供者与服务消费者的概念 二.编写一个服务提供者的测试类(code) 1.1. 使用微服务构建的是分布式系统,微服务之间通过网络进行通信.我们使用微服务提供者与服务消费者来描述微服 ...

  2. spring cloud(二)服务(注册)中心Eureka

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

  3. Spring Cloud(二):Spring Cloud Eureka Server高可用注册服务中心的配置

    前言 Eureka 作为一个云端负载均衡,本身是一个基于REST的服务,在 Spring Cloud 中用于发现和注册服务. 那么当成千上万个微服务注册到Eureka Server中的时候,Eurek ...

  4. spring cloud(二) zuul

    spring cloud 网关 zuul 搭建过程 1. 新建boot工程 pom引入依赖 <dependency> <groupId>org.springframework. ...

  5. Spring Cloud(二):服务消费者

    创建“服务消费者” 创建一个基础的Spring Boot工程,命名为springboot-consumer,并在pom.xml中引入需要的依赖内容: <dependency> <gr ...

  6. 从零开始学spring cloud(二) -------- 开始使用Spring Cloud实战微服务

    1.准备工作 2.服务提供者与服务消费者 3.服务发现与服务注册 服务发现: 服务注册表: 服务注册表是一个记录当前可用服务实例的网络信息的数据库,是服务发现机制的核心.服务注册表提供查询API和管理 ...

  7. Spring Cloud(十四):Ribbon实现客户端负载均衡及其实现原理介绍

    年后到现在一直很忙,都没什么时间记录东西了,其实之前工作中积累了很多知识点,一直都堆在备忘录里,只是因为近几个月经历了一些事情,没有太多的经历来写了,但是一些重要的东西,我还是希望能坚持记录下来.正好 ...

  8. Spring Cloud系列(二):服务提供者

    上一篇介绍了注册中心,这一篇介绍如何把服务注册到注册中心. 一.创建服务提供者 我们依然使用上一篇的项目,在其中创建一个spring boot模块,填好必要的信息,依赖需要选择Spring Web和E ...

  9. Spring Cloud进阶之路 | 二:服务提供者(discovery)

    1 创建父项目 以前文所述,以spring boot 2.1.7.RELEASE为基,spring cloud版本为Greenwich.SR2,spring cloud alibaba版本为2.1.0 ...

随机推荐

  1. jsp标签${fn:contains()}遇到问题记录

    在jsp页面要实现这样一个功能,列表的某一列字段要显示的数据,是从后台的一个列表中获取的,数据库里面该列存储的方式是 类似 1,2,3 这样的 主键id数据.显示的时候要根据id显示名称,如果是多个 ...

  2. csu 1978: LXX的图论题

    1978: LXX的图论题 Submit Page   Summary   Time Limit: 1 Sec     Memory Limit: 128 Mb     Submitted: 71   ...

  3. PHP pdo单例模式连接数据库

    PHP pdo单例模式连接数据库<pre><?php class Db{ private static $pdo; public static function getPdo () ...

  4. OpenLDAP + phpLDAPadmin

    一.基础设置 1.1 环境说明 Centos 7.5 openldap 1.2 关闭防火墙和selinux setenforce sed -i 's/SELINUX=enforcing/SELINUX ...

  5. perl oneline

    可参考博客:http://blog.csdn.net/carzyer/article/details/5117429 Perl常用命令行参数概览 -e 指定字符串以作为脚本(多个字符串迭加)执行 -M ...

  6. ReflectionUtils.invokeMethod的作用

    Object invokeMethod(Method method, Object target, Object... args)在指定对象(target)上,使用指定参数(args),执行方法(me ...

  7. 池化方法总结(Pooling)

       https://blog.csdn.net/mao_kun/article/details/50507376 在卷积神经网络中,我们经常会碰到池化操作,而池化层往往在卷积层后面,通过池化来降低卷 ...

  8. 三、SpringBoot整合Thymeleaf视图

    目录 3.1 Thymeleaf视图介绍 3.2 创建SpringBoot项目 3.2 配置Thymeleaf 3.3 编写Demo 3.4 小结 3.1 Thymeleaf视图介绍 先看下官网的介绍 ...

  9. 虚拟机CentOS克隆

    1.什么是克隆 就是以某虚拟机为母版,复制出一个一模一样的虚拟机出来,包括里面的数据 2.创建克隆 正常选择通过快照创建克隆(只能是关机状态下的克隆) 1.选择关机状态下的快照,然后点击克隆 2.点击 ...

  10. go 程序整个执行过程