原文链接:http://www.yiidian.com/springcloud/build-eureka-single.html

本文介绍搭建单机版的Eureka Server服务

1 创建项目,导入依赖

<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.yiidian</groupId>
<artifactId>eureka-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath />
</parent> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!-- SpringCloud版本,F系列 -->
<spring-cloud.version>Finchley.RC1</spring-cloud.version>
</properties> <dependencies>
<!-- Eureka服务端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies> <dependencyManagement>
<dependencies>
<!-- SpringCloud依赖,一定要放到dependencyManagement中,起到管理版本的作用即可 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> <repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories> </project>

2 配置Eureka

建立application.yml,内容如下:

server:
port: 10086 # 端口 spring:
application:
name: eureka-server # serviceID # 配置Eureka服务
eureka:
client:
fetch-registry: false # 是否拉取Eureka服务器的注册信息,默认true。单机版false,集群版true
register-with-eureka: false # 是否向Eureka服务器注册 ,默认true。单机版false,集群版true
service-url: # 注册地址
defaultZone: http://127.0.0.1:${server.port}/eureka

3 编写启动类

package com.yiidian;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer //开启Eurea Server
@SpringBootApplication
public class EurekaServerApplication { public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
} }

4 运行并访问Eureka Server

运行启动类,浏览器访问: http://localhost:10086,效果如下:

快速搭建单机版Spring Cloud EurekaServer的更多相关文章

  1. vue+uni-app商城实战 | 第一篇:【有来小店】微信小程序快速开发接入Spring Cloud OAuth2认证中心完成授权登录

    一. 前言 本篇通过实战来讲述如何使用uni-app快速进行商城微信小程序的开发以及小程序如何接入后台Spring Cloud微服务. 有来商城 youlai-mall 项目是一套全栈商城系统,技术栈 ...

  2. 快速搭建一个Spring Boot + MyBatis的开发框架

    前言:Spring Boot的自动化配置确实非常强大,为了方便大家把项目迁移到Spring Boot,特意总结了一下如何快速搭建一个Spring Boot + MyBatis的简易文档,下面是简单的步 ...

  3. Hystrix + Hystrix Dashboard搭建(Spring Cloud 2.X)

    本机IP为  192.168.1.102 一.搭建Hystrix Dashboard 1.   新建 Maven 项目  hystrix-dashboard 2. pom.xml <projec ...

  4. 用ZooKeeper做为注册中心搭建基于Spring Cloud实现服务注册与发现

    前提: 先安装好ZooKeeper的环境,搭建参考:http://www.cnblogs.com/EasonJim/p/7482961.html 说明: 可以再简单的理解为有两方协作,一个是服务提供这 ...

  5. Spring cloud ——EurekaServer

    Eureka作为服务注册与发现的组件,Eureka2.0已经闭源了,但是本教程还是以Eureka为核心进行展开. 1.三个模块 Spring Cloud Eureka是Spring Cloud Net ...

  6. 企业快速开发平台Spring Cloud+Spring Boot+Mybatis+ElementUI 实现前后端分离

    鸿鹄云架构一系统管理平台 鸿鹄云架构[系统管理平台]使用J2EE技术来实施,是一个大型分布式的面向服务的JavaEE体系快速研发平台,基于模块化.服务化.原子化.热部署的设计思想,使用成熟领先的无商业 ...

  7. 快速搭建springmvc+spring data jpa工程

    一.前言 这里简单讲述一下如何快速使用springmvc和spring data jpa搭建后台开发工程,并提供了一个简单的demo作为参考. 二.创建maven工程 http://www.cnblo ...

  8. 快速搭建基于Spring Boot + Spring Security 环境

    个人博客网:https://wushaopei.github.io/    (你想要这里多有) 1.Spring Security 权限管理框架介绍 简介: Spring Security 提供了基于 ...

  9. 【第十二篇】- Git 服务器搭建之Spring Cloud直播商城 b2b2c电子商务技术总结

    Git 服务器搭建 上一章节中我们远程仓库使用了 Github,Github 公开的项目是免费的,2019 年开始 Github 私有存储库也可以无限制使用. 这当然我们也可以自己搭建一台 Git 服 ...

随机推荐

  1. Android 获取当前日期距离过期时间的日期差值的完整方法直接使用

    /*** * 获取当前日期距离过期时间的日期差值 * @param endTime * @return */public String dateDiff(String endTime) { Strin ...

  2. 「CF161B」Discounts

    传送门 Luogu 解题思路 贪心地想一想,我们肯定要让凳子去给价格越高的商品打半价,那么我们就先按照价格排序,但是要优先把凳子排在前面. 然后我们发现一条凳子肯定只能给价格小于等于它本身的物品打半价 ...

  3. 在Java中,为什么十六进制数0xFF取反之后对应的十进制数是-256呢?

    int number = 0xFF: 字面值是指在程序中无需变量保存,可直接表示为一个具体的数字或字符串的值. 0xFF是一个整数字面值,整数字面值的缺省类型是 int. 我们知道在Java中, in ...

  4. Mac如何自定义本地化文件夹名

    1. 关闭系统文件保护 在一切开始前,首先要先关闭掉系统的文件保护机制,否则无法修改系统文件,参见`如何关闭 Mac OS X EI Capitan 系统文件保护`这篇文章 2. 添加自定义本地化名称 ...

  5. JavaScript 环境污染

    定义全局变量有 3 种方式: 在任何函数体外直接使用 var 语句声明. var f = 'value1'; 直接添加属性到全局对象上.在 Web 浏览器中,全局作用域对象为 window. wind ...

  6. 深入解读EOS源代码之——区块链内核

    EOS进入大众视野并且受到热议已经有一段时间了,各种热捧和争议过后,是时候让我们静下来搞清楚EOS到底是一个什么样的产品.本文从技术角度深入的分析EOS底层设计,从源代码入手,一层层揭开EOS区块链底 ...

  7. PV & PVC【转】

    Volume 提供了非常好的数据持久化方案,不过在可管理性上还有不足. 拿前面 AWS EBS 的例子来说,要使用 Volume,Pod 必须事先知道如下信息: 当前 Volume 来自 AWS EB ...

  8. Visual Studio中的“build”、“rebuild”、“clean”的区别

    区别 rebuild基本相当于clean+build build只针对修改过的文件进行编译,rebuild会对所有文件编译(无论是否修改). clean 删除中间和输出文件,中间文件是指一些生成应用的 ...

  9. C++编程学习(十二) STL

    一.简介 标准模板库STL,是一组模板类和函数.提供了: 1.容器.用于存储信息. 2.迭代器.用于访问容器中的信息. 3.算法.操作容器内容. 1.容器 STL有两种类型的容器类: (1)顺序容器 ...

  10. Java小项目之:教你做个聊天系统!

    Java小项目之:聊天系统 今天给大家带来的java练手小项目是一个简单的聊天室,界面简单,操作不难. 分为注册系统,登录系统和聊天系统三部分,很适合java小白练手. 完整的源码和素材请关注并私信我 ...