zoukankan      html  css  js  c++  java
  • springcloud注册中心eureka

    1、前提

    springcloud的注册中心是以springboot为基础搭建起来的。

    开发工具:IDEA

    项目管理工具:maven

    2、搭建步骤

    1. 创建一个web项目(建议使用IDEA工具构建项目)
    2. 修改pom文件
      <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
      </dependency>
      <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-eureka-server</artifactId>
          <version>1.4.4.RELEASE</version>
      </dependency>
      
    3. 在springboot的启动类上加上@EnableEurekaServer注解
    4. 添加配置文件
      #项目名
      spring.application.name=spring-cloud-eureka
      #端口号
      server.port=8000
      #表示是否将自己注册到Eureka Server,默认为true
      eureka.client.register-with-eureka=false
      #表示是否从Eureka Server获取注册信息,默认为true。
      eureka.client.fetch-registry=false
      #设置与Eureka Server交互的地址,查询服务和注册服务都需要依赖这个地址。默认是http://localhost:8761/eureka ;多个地址可使用 , 分隔。
      eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
      

    3、效果

  • 相关阅读:
    C#等同于正则表达式的写法
    操作XML
    对比工具集合
    IIS 部署的网站无法启动
    jdk_1.8 下载之后的配置
    sql server 2008认识 DENSE_RANK
    c# 二分查找算法
    c# 使用栈实现有效的括号
    sql server 自定义标量函数
    虚拟机cenos 重置密码
  • 原文地址:https://www.cnblogs.com/lu51211314/p/9625824.html
Copyright © 2011-2022 走看看