接上篇


1、pom.xml与上篇一致
2、新建包及Application启动类
  1. @Configuration
  2. @ComponentScan
  3. @EnableEurekaClient
  4. @EnableAutoConfiguration
  5. @RestController
  6. public class Application {
  7. @RequestMapping(value = "hello",method = RequestMethod.GET)
  8. public String hello(){
  9. return "你好,世界";
  10. }
  11. public static void main(String[] args){
  12. new SpringApplicationBuilder(Application.class).web(true)
  13. .run(args);
  14. }
  15. }
3、新建application.yml配置文件(我们尝试两种不同的配置)
  1. eureka:
  2. client:
  3. serviceUrl:
  4. defaultZone: http://localhost:1000/eureka/
  1. eureka:
  2. client:
  3. serviceUrl:
  4. defaultZone: http://localhost:1000/eureka/
  5. spring:
  6. application:
  7. name: client-service1
  8. server:
  9. port: 2000
4、运行,查看之前Erueka服务端的页面

 

 

Spring Cloud探路(二) Erueka客户端的建立的更多相关文章

  1. (转)Spring Cloud(二)

    (二期)23.微服务框架spring cloud(二) [课程23]熔断器-Hystrix.xmind0.1MB [课程23]微服务...zuul.xmind0.2MB 熔断器-Hystrix 雪崩效 ...

  2. Spring Cloud(二):服务注册与发现 Eureka【Finchley 版】

    Spring Cloud(二):服务注册与发现 Eureka[Finchley 版]  发表于 2018-04-15 |  更新于 2018-05-07 |  上一篇主要介绍了相关理论,这一篇开始我们 ...

  3. Spring Cloud(二):Eureka 服务注册中心

    前言 服务治理 随着业务的发展,微服务应用也随之增加,这些服务的管理和治理会越来越难,并且集群规模.服务位置.服务命名都会发生变化,手动维护的方式极易发生错误或是命名冲突等问题.而服务治理正是为了解决 ...

  4. spring cloud: zuul(二): zuul的serviceId/service-id配置(微网关)

    spring cloud: zuul(二): zuul的serviceId/service-id配置(微网关) zuul: routes: #路由配置表示 myroute1: #路由名一 path: ...

  5. Spring Cloud探路(三)REST 客户端Feign

    Declarative REST Client: Feign Feign is a declarative web service client. It makes writing web servi ...

  6. Spring Cloud(二):Web服务客户端之Ribbon

    上文介绍了服务如何通过Eureka实现注册,以及如何从Eureka获取已经注册的服务列表.那么拿到注册服务列表后, 如何进行服务调用?一个简单的实现是可以从被调用服务的实例列表中选择一个服务实例,通过 ...

  7. spring cloud 专题二(spring cloud 入门搭建 之 微服务搭建和注册)

    一.前言 本文为spring cloud 微服务框架专题的第二篇,主要讲解如何快速搭建微服务以及如何注册. 本文理论不多,主要是傻瓜式的环境搭建,适合新手快速入门. 为了更好的懂得原理,大家可以下载& ...

  8. Spring Cloud(十二):Spring Cloud Zuul 限流详解(附源码)(转)

    前面已经介绍了很多zuul的功能,本篇继续介绍它的另一大功能.在高并发的应用中,限流往往是一个绕不开的话题.本文详细探讨在Spring Cloud中如何实现限流. 在 Zuul 上实现限流是个不错的选 ...

  9. Spring Cloud第四篇 | 客户端负载均衡Ribbon

    ​ 本文是Spring Cloud专栏的第四篇文章,了解前三篇文章内容有助于更好的理解本文: ​Spring Cloud第一篇 | Spring Cloud前言及其常用组件介绍概览 Spring Cl ...

  10. spring cloud 声明式rest客户端feign调用远程http服务

    在Spring Cloud Netflix栈中,各个微服务都是以HTTP接口的形式暴露自身服务的,因此在调用远程服务时就必须使用HTTP客户端.Feign就是Spring Cloud提供的一种声明式R ...

随机推荐

  1. 开启php中短标签<%%>和<??>的方法

    <?  ?> 短标签,兼容的,PHP默认也不支持,需要在php的配置文件中设置! 去到php.ini中开启下面的 <%  %> ASP风格!也是兼容的,也需要配置:

  2. 自学FPAG笔记之 " top_down “

    top_town设计:在FPGA中top_down(自顶向上)是十分重要的一种编程方法,优点:使用top_down方法去写代码会使得程序看起来十分简洁,缺点:top_down写的文件会特别多. 例子: ...

  3. MySQL数据库简单使用

    一.入门语句: 1.连接服务器: 命令:cd 安装目录\bin mysql -uroot -p 接着输入密码 ( 具体的是:mysql -u username-p password ) 远程连接MyS ...

  4. Please upgrade the installed version of powershell to the minimum required version and run the command again.

    版权声明:本文为博主原创文章,转载请注明出处.谢谢 https://blog.csdn.net/cow66/article/details/77993908 我的系统是windows 7 安装了vag ...

  5. 小爬爬5:重点回顾&&移动端数据爬取1

    1. ()什么是selenium - 基于浏览器自动化的一个模块 ()在爬虫中为什么使用selenium及其和爬虫之间的关联 - 可以便捷的获取动态加载的数据 - 实现模拟登陆 ()列举常见的sele ...

  6. Cmake在编译osgEarth时遇到的一个错误

    CMake Error at src/osgEarthDrivers/CMakeLists.txt:7 (PROJECT): The CMAKE_C_COMPILER: llvm-gcc-4.2 is ...

  7. 服务网关zuul----zuul中的动态刷新路由配置

    Spring Cloud实战小贴士:Zuul处理Cookie和重定向 所以解决该问题的思路也很简单,我们只需要通过设置sensitiveHeaders即可,设置方法分为两种: 全局设置: zuul.s ...

  8. working copy is not up-to-date

    解决方法:  在相应文件上,单击选择team,然后选择先更新,然后再提交.这样就好了.

  9. poj 2342 hdu 1520【树形dp】

    poj 2342 给出每个顶点的happy值,还有若干组两个顶点L,K关系,表示K是L的上司.求当K.L不同时出现时获得的happy值的最大和. 设dp[u][0]表示不选u结点时获得的最大值,dp[ ...

  10. GIT 公钥配置

    1.下载git 2.ssh-keygen -t rsa -C "xxx@xxx.com" 3.cd ~/.ssh 4.ls 5.cat id_rsa.pub 或者C:\User\x ...